Version 2.18.0-111.0.dev
Merge commit '37eff8b8bcd124cec3534157b7c397097e112a3c' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
index 53e5e32..021701c 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/suggestion_builder.dart
@@ -974,7 +974,7 @@
withNullability: _isNonNullableByDefault);
_addSuggestion(
suggestion,
- textToMatchOverride: element.displayName,
+ textToMatchOverride: _textToMatchOverride(element),
);
}
@@ -1502,6 +1502,13 @@
suggestion.docSummary = doc.summary;
}
}
+
+ static String _textToMatchOverride(ExecutableElement element) {
+ if (element.isOperator) {
+ return 'operator';
+ }
+ return element.displayName;
+ }
}
abstract class SuggestionListener {
diff --git a/pkg/analysis_server/lib/src/utilities/extensions/element.dart b/pkg/analysis_server/lib/src/utilities/extensions/element.dart
index 1bc51b1..bfe5606 100644
--- a/pkg/analysis_server/lib/src/utilities/extensions/element.dart
+++ b/pkg/analysis_server/lib/src/utilities/extensions/element.dart
@@ -38,7 +38,7 @@
ancestor = ancestor.enclosingElement;
}
return ancestor is CompilationUnitElement &&
- ancestor.enclosingElement.hasDeprecated;
+ ancestor.enclosingElement2.hasDeprecated;
}
/// Return this element and all its enclosing elements.
diff --git a/pkg/analysis_server/test/protocol_server_test.dart b/pkg/analysis_server/test/protocol_server_test.dart
index 02e6971..603ea68 100644
--- a/pkg/analysis_server/test/protocol_server_test.dart
+++ b/pkg/analysis_server/test/protocol_server_test.dart
@@ -240,11 +240,13 @@
EnumTester<engine.ElementKind, ElementKind>()
.run(convertElementKind, exceptions: {
// TODO(paulberry): do any of the exceptions below constitute bugs?
+ engine.ElementKind.AUGMENTATION_IMPORT: ElementKind.UNKNOWN,
engine.ElementKind.DYNAMIC: ElementKind.UNKNOWN,
engine.ElementKind.ERROR: ElementKind.UNKNOWN,
engine.ElementKind.EXPORT: ElementKind.UNKNOWN,
engine.ElementKind.GENERIC_FUNCTION_TYPE: ElementKind.FUNCTION_TYPE_ALIAS,
engine.ElementKind.IMPORT: ElementKind.UNKNOWN,
+ engine.ElementKind.LIBRARY_AUGMENTATION: ElementKind.UNKNOWN,
engine.ElementKind.NAME: ElementKind.UNKNOWN,
engine.ElementKind.NEVER: ElementKind.UNKNOWN,
engine.ElementKind.UNIVERSE: ElementKind.UNKNOWN
diff --git a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
index ca3535f..c9003f8 100644
--- a/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/location/class_body_test.dart
@@ -312,6 +312,109 @@
}
mixin OverrideTestCases on AbstractCompletionDriverTest {
+ Future<void> test_class_inComment() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ // foo^
+ void bar() {}
+}
+''');
+
+ check(response).suggestions.overrides.isEmpty;
+ }
+
+ Future<void> test_class_inComment_dartdoc() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ /// foo^
+ void bar() {}
+}
+''');
+
+ check(response).suggestions.overrides.isEmpty;
+ }
+
+ Future<void> test_class_inComment_reference() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ /// [foo^]
+ void bar() {}
+}
+''');
+
+ check(response).suggestions.overrides.isEmpty;
+ }
+
+ Future<void> test_class_method_alreadyOverridden() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+ void foo02() {}
+}
+
+class B extends A {
+ void foo02() {}
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides
+ ..includesAll([
+ _isOverrideWithSuper_foo01,
+ ])
+ ..excludesAll([
+ (suggestion) => suggestion.completion.contains('foo02'),
+ ]);
+ }
+
+ Future<void> test_class_method_beforeField() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ foo^
+
+ int bar = 0;
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
+ Future<void> test_class_method_beforeMethod() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ foo^
+
+ void bar() {}
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
Future<void> test_class_method_fromExtends() async {
final response = await getTestCodeSuggestions('''
class A {
@@ -324,12 +427,115 @@
''');
check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
+ Future<void> test_class_method_fromExtends_fromPart() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+part of 'test.dart';
+
+class A {
+ void foo01() {}
+}
+''');
+
+ final response = await getTestCodeSuggestions('''
+part 'a.dart';
+
+class B extends A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
+ Future<void> test_class_method_fromExtends_multiple() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ void foo02() {}
+}
+
+class C extends B {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ _isOverrideWithSuper_foo02,
+ ]);
+ }
+
+ Future<void> test_class_method_fromExtends_private_otherLibrary() async {
+ newFile('$testPackageLibPath/a.dart', r'''
+class A {
+ // ignore:unused_element
+ void _foo01() {}
+ void foo02() {}
+}
+''');
+
+ final response = await getTestCodeSuggestions('''
+import 'a.dart';
+
+class B extends A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides
+ ..includesAll([
+ _isOverrideWithSuper_foo02,
+ ])
+ ..excludesAll([
+ _isOverrideWithSuper_private_foo01,
+ ]);
+ }
+
+ Future<void> test_class_method_fromExtends_private_thisLibrary() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void _foo01() {}
+ void foo02() {}
+}
+
+class B extends A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_private_foo01,
+ _isOverrideWithSuper_foo02,
+ ]);
+ }
+
+ Future<void> test_class_method_fromExtends_withOverride() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+class B extends A {
+ @override
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
(suggestion) => suggestion
..displayText.isEqualTo('foo01() { … }')
- ..hasSelection(offset: 60, length: 14)
+ ..hasSelection(offset: 48, length: 14)
..completion.isEqualTo(r'''
-@override
- void foo01() {
+void foo01() {
// TODO: implement foo01
super.foo01();
}'''),
@@ -348,14 +554,7 @@
''');
check(response).suggestions.overrides.includesAll([
- (suggestion) => suggestion
- ..displayText.isEqualTo('foo01() { … }')
- ..hasSelection(offset: 55)
- ..completion.isEqualTo(r'''
-@override
- void foo01() {
- // TODO: implement foo01
- }'''),
+ _isOverrideWithoutSuper_foo01,
]);
}
@@ -371,16 +570,175 @@
''');
check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
+ Future<void> test_class_operator_eqEq() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ opera^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
(suggestion) => suggestion
- ..displayText.isEqualTo('foo01() { … }')
- ..hasSelection(offset: 60, length: 14)
+ ..displayText.isEqualTo('==(Object other) { … }')
+ ..hasSelection(offset: 75, length: 22)
..completion.isEqualTo(r'''
@override
+ bool operator ==(Object other) {
+ // TODO: implement ==
+ return super == other;
+ }'''),
+ ]);
+ }
+
+ Future<void> test_class_operator_plus() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ int operator +(int other) { }
+}
+
+class B extends A {
+ opera^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ (suggestion) => suggestion
+ ..displayText.isEqualTo('+(int other) { … }')
+ ..hasSelection(offset: 69, length: 21)
+ ..completion.isEqualTo(r'''
+@override
+ int operator +(int other) {
+ // TODO: implement +
+ return super + other;
+ }'''),
+ ]);
+ }
+
+ Future<void> test_extension_method() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+extension E on A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.isEmpty;
+ }
+
+ Future<void> test_mixin_method_fromConstraints_alreadyOverridden() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+ void foo02() {}
+}
+
+mixin M on A {
+ void foo02() {}
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides
+ ..includesAll([
+ _isOverrideWithSuper_foo01,
+ ])
+ ..excludesAll([
+ (suggestion) => suggestion.completion.contains('foo02'),
+ ]);
+ }
+
+ Future<void> test_mixin_method_fromImplements() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+mixin M implements A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithoutSuper_foo01,
+ ]);
+ }
+
+ Future<void> test_mixin_method_fromSuperclassConstraint() async {
+ final response = await getTestCodeSuggestions('''
+class A {
+ void foo01() {}
+}
+
+mixin M on A {
+ foo^
+}
+''');
+
+ check(response).suggestions.overrides.includesAll([
+ _isOverrideWithSuper_foo01,
+ ]);
+ }
+
+ static void _isOverrideWithoutSuper_foo01(
+ CheckTarget<CompletionSuggestionForTesting> suggestion,
+ ) {
+ suggestion
+ ..displayText.isEqualTo('foo01() { … }')
+ ..hasSelection(offset: 55)
+ ..completion.isEqualTo(r'''
+@override
+ void foo01() {
+ // TODO: implement foo01
+ }''');
+ }
+
+ static void _isOverrideWithSuper_foo01(
+ CheckTarget<CompletionSuggestionForTesting> suggestion,
+ ) {
+ suggestion
+ ..displayText.isEqualTo('foo01() { … }')
+ ..hasSelection(offset: 60, length: 14)
+ ..completion.isEqualTo(r'''
+@override
void foo01() {
// TODO: implement foo01
super.foo01();
- }'''),
- ]);
+ }''');
+ }
+
+ static void _isOverrideWithSuper_foo02(
+ CheckTarget<CompletionSuggestionForTesting> suggestion,
+ ) {
+ suggestion
+ ..displayText.isEqualTo('foo02() { … }')
+ ..hasSelection(offset: 60, length: 14)
+ ..completion.isEqualTo(r'''
+@override
+ void foo02() {
+ // TODO: implement foo02
+ super.foo02();
+ }''');
+ }
+
+ static void _isOverrideWithSuper_private_foo01(
+ CheckTarget<CompletionSuggestionForTesting> suggestion,
+ ) {
+ suggestion
+ ..displayText.isEqualTo('_foo01() { … }')
+ ..hasSelection(offset: 62, length: 15)
+ ..completion.isEqualTo(r'''
+@override
+ void _foo01() {
+ // TODO: implement _foo01
+ super._foo01();
+ }''');
}
}
diff --git a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
deleted file mode 100644
index 1b0ab51..0000000
--- a/pkg/analysis_server/test/services/completion/dart/override_contributor_test.dart
+++ /dev/null
@@ -1,599 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
-import 'package:analysis_server/src/services/completion/dart/completion_manager.dart';
-import 'package:analysis_server/src/services/completion/dart/override_contributor.dart';
-import 'package:analysis_server/src/services/completion/dart/suggestion_builder.dart';
-import 'package:analyzer_plugin/protocol/protocol_common.dart';
-import 'package:test/test.dart';
-import 'package:test_reflective_loader/test_reflective_loader.dart';
-
-import 'completion_contributor_util.dart';
-
-void main() {
- defineReflectiveTests(OverrideContributorTest);
-}
-
-@reflectiveTest
-class OverrideContributorTest extends DartCompletionContributorTest {
- @override
- DartCompletionContributor createContributor(
- DartCompletionRequest request,
- SuggestionBuilder builder,
- ) {
- return OverrideContributor(request, builder);
- }
-
- Future<void> test_alreadyOverridden() async {
- addTestSource('''
-class A {
- void foo() {}
- void bar() {}
-}
-
-class B implements A {
- void bar() {}
- f^
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('bar');
- }
-
- Future<void> test_beforeGetter() async {
- addTestSource('''
-class A {
- method() {}
- int? age;
-}
-
-class B extends A {
- m^
-
- String value1 = '';
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- method() {
- // TODO: implement method
- return super.method();
- }''',
- displayText: 'method() { … }',
- selectionOffset: 57,
- selectionLength: 22);
- }
-
- Future<void> test_beforeMethod() async {
- addTestSource('''
-class A {
- method() {}
- int? age;
-}
-
-class B extends A {
- m^
-
- void b() {}
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- method() {
- // TODO: implement method
- return super.method();
- }''',
- displayText: 'method() { … }',
- selectionOffset: 57,
- selectionLength: 22);
- }
-
- Future<void> test_customOperator() async {
- addTestSource('''
-class A {
- void operator &(A other) { }
-}
-class B extends A {
- other^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- void operator &(A other) {
- // TODO: implement &
- super & other;
- }''',
- displayText: '&(A other) { … }',
- selectionOffset: 68,
- selectionLength: 14);
- }
-
- Future<void> test_equalsOperator() async {
- addTestSource('''
-class A {
- other^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- bool operator ==(Object other) {
- // TODO: implement ==
- return super == other;
- }''',
- displayText: '==(Object other) { … }',
- selectionOffset: 75,
- selectionLength: 22);
- }
-
- Future<void> test_fromMultipleSuperclasses() async {
- addTestSource(r'''
-class A {
- A suggested1(int x) => null;
- B suggested2(String y) => null;
-}
-class B extends A {
- B suggested2(String y) => null;
- C suggested3([String z]) => null;
- void suggested4() { }
- int get suggested5 => null;
-}
-class C extends B {
- sugg^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- A suggested1(int x) {
- // TODO: implement suggested1
- return super.suggested1(x);
- }''',
- displayText: 'suggested1(int x) { … }',
- selectionOffset: 72,
- selectionLength: 27);
- _assertOverride('''
-@override
- A suggested1(int x) {
- // TODO: implement suggested1
- return super.suggested1(x);
- }''',
- displayText: 'suggested1(int x) { … }',
- selectionOffset: 72,
- selectionLength: 27);
- _assertOverride('''
-@override
- B suggested2(String y) {
- // TODO: implement suggested2
- return super.suggested2(y);
- }''',
- displayText: 'suggested2(String y) { … }',
- selectionOffset: 75,
- selectionLength: 27);
- _assertOverride('''
-@override
- C suggested3([String z]) {
- // TODO: implement suggested3
- return super.suggested3(z);
- }''',
- displayText: 'suggested3([String z]) { … }',
- selectionOffset: 77,
- selectionLength: 27);
- _assertOverride('''
-@override
- void suggested4() {
- // TODO: implement suggested4
- super.suggested4();
- }''',
- displayText: 'suggested4() { … }',
- selectionOffset: 70,
- selectionLength: 19);
- _assertOverride('''
-@override
- // TODO: implement suggested5
- int get suggested5 => super.suggested5;''',
- displayText: 'suggested5 => …',
- selectionOffset: 66,
- selectionLength: 16);
- }
-
- Future<void> test_fromPart() async {
- addSource('$testPackageLibPath/myLib.dart', '''
-library myLib;
-part 'test.dart';
-part 'otherPart.dart';
-class A {
- A suggested1(int x) => null;
- B suggested2(String y) => null;
-}
-''');
- addSource('$testPackageLibPath/otherPart.dart', '''
-part of myLib;
-class B extends A {
- B suggested2(String y) => null;
- C suggested3([String z]) => null;
-}
-''');
- addTestSource(r'''
-part of myLib;
-class C extends B {
- sugg^
-}
-''');
- // assume information for context.getLibrariesContaining has been cached
- await resolveFile('$testPackageLibPath/myLib.dart');
- await computeSuggestions();
- _assertOverride('''
-@override
- A suggested1(int x) {
- // TODO: implement suggested1
- return super.suggested1(x);
- }''', displayText: 'suggested1(int x) { … }');
- _assertOverride('''
-@override
- A suggested1(int x) {
- // TODO: implement suggested1
- return super.suggested1(x);
- }''',
- displayText: 'suggested1(int x) { … }',
- selectionOffset: 72,
- selectionLength: 27);
- _assertOverride('''
-@override
- B suggested2(String y) {
- // TODO: implement suggested2
- return super.suggested2(y);
- }''',
- displayText: 'suggested2(String y) { … }',
- selectionOffset: 75,
- selectionLength: 27);
- _assertOverride('''
-@override
- C suggested3([String z]) {
- // TODO: implement suggested3
- return super.suggested3(z);
- }''',
- displayText: 'suggested3([String z]) { … }',
- selectionOffset: 77,
- selectionLength: 27);
- }
-
- Future<void> test_inClass_of_interface() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- f^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- void foo() {
- // TODO: implement foo
- }''', displayText: 'foo() { … }', selectionOffset: 51, selectionLength: 0);
- }
-
- Future<void> test_inComment() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- // comment^
- void m() {}
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inComment_dartdoc() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- /// dartdoc^
- void m() {}
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inComment_reference() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- /// Asdf [St^]
- void m() {}
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inConstructor() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- var one;
- B(this.^);
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inConstructor2() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- var one;
- var two;
- B(this.one, {this.^});
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inFieldDeclaration_name() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- final String ^type;
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inFieldDeclaration_value() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B implements A {
- final String type = '^';
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_inMixin_of_interface() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-mixin M implements A {
- f^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- void foo() {
- // TODO: implement foo
- }''', displayText: 'foo() { … }', selectionOffset: 51, selectionLength: 0);
- }
-
- Future<void> test_inMixin_of_superclassConstraint() async {
- addTestSource('''
-class A {
- void foo() {}
-}
-
-mixin M on A {
- f^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- void foo() {
- // TODO: implement foo
- super.foo();
- }''', displayText: 'foo() { … }', selectionOffset: 56, selectionLength: 12);
- }
-
- @failingTest
- Future<void> test_insideBareClass() async {
- addTestSource('''
-class A {
- method() {}
- int age;
-}
-
-class B extends A {
- ^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-@override
- method() {
- // TODO: implement method
- return super.method();
- }''',
- displayText: 'method() { … }',
- selectionOffset: 57,
- selectionLength: 22);
- }
-
- Future<void> test_outsideOfWorkspace() async {
- testFile = convertPath('/home/other/lib/a.dart');
- addTestSource('''
-class A {
- void foo() {}
-}
-
-class B extends A {
- f^
-}
-''');
- await computeSuggestions();
- _assertNoOverrideContaining('foo');
- }
-
- Future<void> test_private_otherLibrary() async {
- newFile('$testPackageLibPath/a.dart', '''
-class A {
- void foo() {}
- void _bar() {}
-}
-''');
- addTestSource(r'''
-import 'a.dart';
-
-class B extends A {
- f^
-}
-''');
- await computeSuggestions();
-
- _assertOverride('''
-@override
- void foo() {
- // TODO: implement foo
- super.foo();
- }''', displayText: 'foo() { … }', selectionOffset: 56, selectionLength: 12);
-
- expect(suggestions, _notSuggestedPredicate((suggestion) {
- return suggestion.completion.contains('void _bar()');
- }));
- }
-
- Future<void> test_private_thisLibrary() async {
- addTestSource(r'''
-class A {
- void foo() {}
- void _bar() {}
-}
-
-class B extends A {
- f^
-}
-''');
- await computeSuggestions();
-
- _assertOverride('''
-@override
- void foo() {
- // TODO: implement foo
- super.foo();
- }''', displayText: 'foo() { … }', selectionOffset: 56, selectionLength: 12);
-
- _assertOverride('''
-@override
- void _bar() {
- // TODO: implement _bar
- super._bar();
- }''', displayText: '_bar() { … }', selectionOffset: 58, selectionLength: 13);
- }
-
- Future<void> test_withExistingOverride() async {
- addTestSource('''
-class A {
- method() {}
- int age;
-}
-
-class B extends A {
- @override
- meth^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-method() {
- // TODO: implement method
- return super.method();
- }''',
- displayText: 'method() { … }',
- selectionOffset: 45,
- selectionLength: 22);
- }
-
- @failingTest
- Future<void> test_withOverrideAnnotation() async {
- addTestSource('''
-class A {
- method() {}
- int age;
-}
-
-class B extends A {
- @override
- ^
-}
-''');
- await computeSuggestions();
- _assertOverride('''
-method() {
- // TODO: implement method
- return super.method();
- }''',
- displayText: 'method() { … }',
- selectionOffset: 45,
- selectionLength: 22);
- }
-
- void _assertNoOverrideContaining(String search) {
- expect(
- suggestions.where((c) =>
- c.kind == CompletionSuggestionKind.OVERRIDE &&
- c.completion.contains(search)),
- isEmpty);
- }
-
- CompletionSuggestion _assertOverride(String completion,
- {String? displayText, int? selectionOffset, int? selectionLength}) {
- var cs = getSuggest(
- completion: completion,
- csKind: CompletionSuggestionKind.OVERRIDE,
- elemKind: null);
- if (cs == null) {
- failedCompletion('expected $completion', suggestions);
- }
- expect(cs.kind, equals(CompletionSuggestionKind.OVERRIDE));
- if (selectionOffset != null && selectionLength != null) {
- expect(cs.selectionOffset, selectionOffset);
- expect(cs.selectionLength, selectionLength);
- }
- expect(cs.isDeprecated, isFalse);
- expect(cs.isPotential, isFalse);
- expect(cs.element, isNotNull);
- expect(cs.displayText, displayText);
- return cs;
- }
-
- static Matcher _notSuggestedPredicate(bool Function(CompletionSuggestion) f) {
- return isNot(contains(predicate(f)));
- }
-}
diff --git a/pkg/analysis_server/test/services/completion/dart/test_all.dart b/pkg/analysis_server/test/services/completion/dart/test_all.dart
index 29e4a22..041b84c 100644
--- a/pkg/analysis_server/test/services/completion/dart/test_all.dart
+++ b/pkg/analysis_server/test/services/completion/dart/test_all.dart
@@ -19,7 +19,6 @@
import 'local_reference_contributor_test.dart' as local_ref_test;
import 'location/test_all.dart' as location;
import 'named_constructor_contributor_test.dart' as named_contributor_test;
-import 'override_contributor_test.dart' as override_contributor_test;
import 'relevance/test_all.dart' as relevance_tests;
import 'static_member_contributor_test.dart' as static_contributor_test;
import 'type_member_contributor_test.dart' as type_member_contributor_test;
@@ -43,7 +42,6 @@
local_ref_test.main();
location.main();
named_contributor_test.main();
- override_contributor_test.main();
relevance_tests.main();
static_contributor_test.main();
type_member_contributor_test.main();
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 024d39b..1ac9cdd 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -409,6 +409,10 @@
@override
LibraryElement get enclosingElement;
+ /// Return the library, or library augmentation that encloses this unit.
+ @experimental
+ LibraryOrAugmentationElement get enclosingElement2;
+
/// Return a list containing all of the enums contained in this compilation
/// unit.
List<ClassElement> get enums;
@@ -867,70 +871,76 @@
///
/// Clients may not extend, implement or mix-in this class.
class ElementKind implements Comparable<ElementKind> {
- static const ElementKind CLASS = ElementKind('CLASS', 0, "class");
+ static const ElementKind AUGMENTATION_IMPORT =
+ ElementKind('AUGMENTATION_IMPORT', 0, "augmentation import");
+
+ static const ElementKind CLASS = ElementKind('CLASS', 1, "class");
static const ElementKind COMPILATION_UNIT =
- ElementKind('COMPILATION_UNIT', 1, "compilation unit");
+ ElementKind('COMPILATION_UNIT', 2, "compilation unit");
static const ElementKind CONSTRUCTOR =
- ElementKind('CONSTRUCTOR', 2, "constructor");
+ ElementKind('CONSTRUCTOR', 3, "constructor");
- static const ElementKind DYNAMIC = ElementKind('DYNAMIC', 3, "<dynamic>");
+ static const ElementKind DYNAMIC = ElementKind('DYNAMIC', 4, "<dynamic>");
- static const ElementKind ENUM = ElementKind('ENUM', 4, "enum");
+ static const ElementKind ENUM = ElementKind('ENUM', 5, "enum");
- static const ElementKind ERROR = ElementKind('ERROR', 5, "<error>");
+ static const ElementKind ERROR = ElementKind('ERROR', 6, "<error>");
static const ElementKind EXPORT =
- ElementKind('EXPORT', 6, "export directive");
+ ElementKind('EXPORT', 7, "export directive");
- static const ElementKind EXTENSION = ElementKind('EXTENSION', 7, "extension");
+ static const ElementKind EXTENSION = ElementKind('EXTENSION', 8, "extension");
- static const ElementKind FIELD = ElementKind('FIELD', 8, "field");
+ static const ElementKind FIELD = ElementKind('FIELD', 9, "field");
- static const ElementKind FUNCTION = ElementKind('FUNCTION', 9, "function");
+ static const ElementKind FUNCTION = ElementKind('FUNCTION', 10, "function");
static const ElementKind GENERIC_FUNCTION_TYPE =
- ElementKind('GENERIC_FUNCTION_TYPE', 10, 'generic function type');
+ ElementKind('GENERIC_FUNCTION_TYPE', 11, 'generic function type');
- static const ElementKind GETTER = ElementKind('GETTER', 11, "getter");
+ static const ElementKind GETTER = ElementKind('GETTER', 12, "getter");
static const ElementKind IMPORT =
- ElementKind('IMPORT', 12, "import directive");
+ ElementKind('IMPORT', 13, "import directive");
- static const ElementKind LABEL = ElementKind('LABEL', 13, "label");
+ static const ElementKind LABEL = ElementKind('LABEL', 14, "label");
- static const ElementKind LIBRARY = ElementKind('LIBRARY', 14, "library");
+ static const ElementKind LIBRARY = ElementKind('LIBRARY', 15, "library");
+
+ static const ElementKind LIBRARY_AUGMENTATION =
+ ElementKind('LIBRARY_AUGMENTATION', 16, "library augmentation");
static const ElementKind LOCAL_VARIABLE =
- ElementKind('LOCAL_VARIABLE', 15, "local variable");
+ ElementKind('LOCAL_VARIABLE', 17, "local variable");
- static const ElementKind METHOD = ElementKind('METHOD', 16, "method");
+ static const ElementKind METHOD = ElementKind('METHOD', 18, "method");
- static const ElementKind NAME = ElementKind('NAME', 17, "<name>");
+ static const ElementKind NAME = ElementKind('NAME', 19, "<name>");
- static const ElementKind NEVER = ElementKind('NEVER', 18, "<never>");
+ static const ElementKind NEVER = ElementKind('NEVER', 20, "<never>");
static const ElementKind PARAMETER =
- ElementKind('PARAMETER', 19, "parameter");
+ ElementKind('PARAMETER', 21, "parameter");
- static const ElementKind PREFIX = ElementKind('PREFIX', 20, "import prefix");
+ static const ElementKind PREFIX = ElementKind('PREFIX', 22, "import prefix");
- static const ElementKind SETTER = ElementKind('SETTER', 21, "setter");
+ static const ElementKind SETTER = ElementKind('SETTER', 23, "setter");
static const ElementKind TOP_LEVEL_VARIABLE =
- ElementKind('TOP_LEVEL_VARIABLE', 22, "top level variable");
+ ElementKind('TOP_LEVEL_VARIABLE', 24, "top level variable");
static const ElementKind FUNCTION_TYPE_ALIAS =
- ElementKind('FUNCTION_TYPE_ALIAS', 23, "function type alias");
+ ElementKind('FUNCTION_TYPE_ALIAS', 25, "function type alias");
static const ElementKind TYPE_PARAMETER =
- ElementKind('TYPE_PARAMETER', 24, "type parameter");
+ ElementKind('TYPE_PARAMETER', 26, "type parameter");
static const ElementKind TYPE_ALIAS =
- ElementKind('TYPE_ALIAS', 25, "type alias");
+ ElementKind('TYPE_ALIAS', 27, "type alias");
- static const ElementKind UNIVERSE = ElementKind('UNIVERSE', 26, "<universe>");
+ static const ElementKind UNIVERSE = ElementKind('UNIVERSE', 28, "<universe>");
static const List<ElementKind> values = [
CLASS,
@@ -1017,6 +1027,8 @@
/// * ThrowingElementVisitor which implements every visit method by throwing an
/// exception.
abstract class ElementVisitor<R> {
+ R? visitAugmentationImportElement(AugmentationImportElement element);
+
R? visitClassElement(ClassElement element);
R? visitCompilationUnitElement(CompilationUnitElement element);
@@ -1039,6 +1051,8 @@
R? visitLabelElement(LabelElement element);
+ R? visitLibraryAugmentationElement(LibraryAugmentationElement element);
+
R? visitLibraryElement(LibraryElement element);
R? visitLocalVariableElement(LocalVariableElement element);
@@ -1640,6 +1654,10 @@
@override
LibraryElement get enclosingElement;
+ /// Return the library, or library augmentation that encloses this element.
+ @experimental
+ LibraryOrAugmentationElement get enclosingElement2;
+
@override
String get name;
diff --git a/pkg/analyzer/lib/dart/element/visitor.dart b/pkg/analyzer/lib/dart/element/visitor.dart
index aede2b6..ace3ca2 100644
--- a/pkg/analyzer/lib/dart/element/visitor.dart
+++ b/pkg/analyzer/lib/dart/element/visitor.dart
@@ -83,6 +83,10 @@
const GeneralizingElementVisitor();
@override
+ R? visitAugmentationImportElement(AugmentationImportElement element) =>
+ visitElement(element);
+
+ @override
R? visitClassElement(ClassElement element) => visitElement(element);
@override
@@ -129,6 +133,10 @@
R? visitLabelElement(LabelElement element) => visitElement(element);
@override
+ R? visitLibraryAugmentationElement(LibraryAugmentationElement element) =>
+ visitElement(element);
+
+ @override
R? visitLibraryElement(LibraryElement element) => visitElement(element);
R? visitLocalElement(LocalElement element) {
@@ -202,6 +210,12 @@
const RecursiveElementVisitor();
@override
+ R? visitAugmentationImportElement(AugmentationImportElement element) {
+ element.visitChildren(this);
+ return null;
+ }
+
+ @override
R? visitClassElement(ClassElement element) {
element.visitChildren(this);
return null;
@@ -268,6 +282,12 @@
}
@override
+ R? visitLibraryAugmentationElement(LibraryAugmentationElement element) {
+ element.visitChildren(this);
+ return null;
+ }
+
+ @override
R? visitLibraryElement(LibraryElement element) {
element.visitChildren(this);
return null;
@@ -345,6 +365,9 @@
const SimpleElementVisitor();
@override
+ R? visitAugmentationImportElement(AugmentationImportElement element) => null;
+
+ @override
R? visitClassElement(ClassElement element) => null;
@override
@@ -380,6 +403,10 @@
R? visitLabelElement(LabelElement element) => null;
@override
+ R? visitLibraryAugmentationElement(LibraryAugmentationElement element) =>
+ null;
+
+ @override
R? visitLibraryElement(LibraryElement element) => null;
@override
@@ -426,6 +453,10 @@
const ThrowingElementVisitor();
@override
+ R? visitAugmentationImportElement(AugmentationImportElement element) =>
+ _throw(element);
+
+ @override
R? visitClassElement(ClassElement element) => _throw(element);
@override
@@ -462,6 +493,10 @@
R? visitLabelElement(LabelElement element) => _throw(element);
@override
+ R? visitLibraryAugmentationElement(LibraryAugmentationElement element) =>
+ _throw(element);
+
+ @override
R? visitLibraryElement(LibraryElement element) => _throw(element);
@override
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 1f4cdab..d089ded 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -962,8 +962,12 @@
// The name of a NamedType does not provide any context.
// So, we don't need to resolve anything.
if (parent is NamedType) {
- // `{foo^ print(0);}` looks as `foo print; (0);`.
var parent3 = parent.parent?.parent;
+ // `class A {foo^ int bar = 0;}` looks as `class A {foo int; bar = 0;}`.
+ if (parent3 is FieldDeclaration) {
+ return false;
+ }
+ // `{foo^ print(0);}` looks as `foo print; (0);`.
if (parent3 is VariableDeclarationStatement &&
parent3.semicolon.isSynthetic) {
return false;
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 392afd4..94e99c7 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -13,6 +13,8 @@
import 'package:analyzer/dart/element/nullability_suffix.dart';
import 'package:analyzer/dart/element/scope.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/dart/element/type_provider.dart';
+import 'package:analyzer/dart/element/type_system.dart';
import 'package:analyzer/error/error.dart';
import 'package:analyzer/src/context/source.dart';
import 'package:analyzer/src/dart/analysis/experiments.dart';
@@ -518,6 +520,30 @@
}
}
+/// A concrete implementation of a [AugmentationImportElement].
+class AugmentationImportElementImpl extends UriReferencedElementImpl
+ implements AugmentationImportElement {
+ @override
+ final LibraryAugmentationElement augmentation;
+
+ AugmentationImportElementImpl({
+ required this.augmentation,
+ required int nameOffset,
+ }) : super(null, nameOffset);
+
+ @override
+ LibraryOrAugmentationElementImpl get enclosingElement {
+ return super.enclosingElement as LibraryOrAugmentationElementImpl;
+ }
+
+ @override
+ ElementKind get kind => ElementKind.AUGMENTATION_IMPORT;
+
+ @override
+ T? accept<T>(ElementVisitor<T> visitor) =>
+ visitor.visitAugmentationImportElement(this);
+}
+
/// An [AbstractClassElementImpl] which is a class.
class ClassElementImpl extends AbstractClassElementImpl {
/// For classes which are not mixin applications, a list containing all of the
@@ -1077,6 +1103,10 @@
super.enclosingElement as LibraryElement;
@override
+ LibraryOrAugmentationElement get enclosingElement2 =>
+ super.enclosingElement as LibraryOrAugmentationElement;
+
+ @override
CompilationUnitElementImpl get enclosingUnit {
return this;
}
@@ -3626,9 +3656,55 @@
T? accept<T>(ElementVisitor<T> visitor) => visitor.visitLabelElement(this);
}
+class LibraryAugmentationElementImpl extends LibraryOrAugmentationElementImpl
+ implements LibraryAugmentationElement {
+ @override
+ final LibraryOrAugmentationElement augmented;
+
+ LibraryAugmentationElementImpl({
+ required this.augmented,
+ required int nameOffset,
+ }) : super(name: null, nameOffset: nameOffset);
+
+ @override
+ // TODO: implement accessibleExtensions
+ List<ExtensionElement> get accessibleExtensions => throw UnimplementedError();
+
+ @override
+ FeatureSet get featureSet => augmented.featureSet;
+
+ @override
+ bool get isNonNullableByDefault => augmented.isNonNullableByDefault;
+
+ @override
+ ElementKind get kind => ElementKind.LIBRARY_AUGMENTATION;
+
+ @override
+ LibraryLanguageVersion get languageVersion => augmented.languageVersion;
+
+ @override
+ // TODO: implement scope
+ Scope get scope => throw UnimplementedError();
+
+ @override
+ AnalysisSession get session => augmented.session;
+
+ @override
+ TypeProvider get typeProvider => augmented.typeProvider;
+
+ @override
+ TypeSystem get typeSystem => augmented.typeSystem;
+
+ @override
+ T? accept<T>(ElementVisitor<T> visitor) {
+ return visitor.visitLibraryAugmentationElement(this);
+ }
+}
+
/// A concrete implementation of a [LibraryElement].
-class LibraryElementImpl extends _ExistingElementImpl
- implements LibraryElement, MacroTargetElementContainer {
+class LibraryElementImpl extends LibraryOrAugmentationElementImpl
+ with _HasLibraryMixin
+ implements LibraryElement {
/// The analysis context in which this library is defined.
@override
final AnalysisContext context;
@@ -3654,21 +3730,10 @@
@override
final FeatureSet featureSet;
- /// The compilation unit that defines this library.
- late CompilationUnitElementImpl _definingCompilationUnit;
-
/// The entry point for this library, or `null` if this library does not have
/// an entry point.
FunctionElement? _entryPoint;
- /// A list containing specifications of all of the imports defined in this
- /// library.
- List<ImportElement> _imports = _Sentinel.importElement;
-
- /// A list containing specifications of all of the exports defined in this
- /// library.
- List<ExportElement> _exports = _Sentinel.exportElement;
-
/// A list containing all of the compilation units that are included in this
/// library using a `part` directive.
List<CompilationUnitElement> _parts = const <CompilationUnitElement>[];
@@ -3689,9 +3754,6 @@
/// computed yet.
Namespace? _publicNamespace;
- /// The cached list of prefixes.
- List<PrefixElement>? _prefixes;
-
/// The scope of this library, `null` if it has not been created yet.
LibraryScope? _scope;
@@ -3703,30 +3765,12 @@
LibraryElementImpl(this.context, this.session, String name, int offset,
this.nameLength, this.featureSet)
: linkedData = null,
- super(name, offset);
+ super(name: name, nameOffset: offset);
@override
List<ExtensionElement> get accessibleExtensions => scope.extensions;
@override
- List<AugmentationImportElement> get augmentationImports {
- // TODO(scheglov): implement augmentationImports
- throw UnimplementedError();
- }
-
- @override
- CompilationUnitElementImpl get definingCompilationUnit =>
- _definingCompilationUnit;
-
- /// Set the compilation unit that defines this library to the given
- /// compilation[unit].
- set definingCompilationUnit(CompilationUnitElement unit) {
- assert((unit as CompilationUnitElementImpl).librarySource == unit.source);
- (unit as CompilationUnitElementImpl).enclosingElement = this;
- _definingCompilationUnit = unit;
- }
-
- @override
CompilationUnitElementImpl get enclosingUnit {
return _definingCompilationUnit;
}
@@ -3779,19 +3823,6 @@
return _exports;
}
- /// Set the specifications of all of the exports defined in this library to
- /// the given list of [exports].
- set exports(List<ExportElement> exports) {
- for (ExportElement exportElement in exports) {
- (exportElement as ExportElementImpl).enclosingElement = this;
- }
- _exports = exports;
- }
-
- List<ExportElement> get exports_unresolved {
- return _exports;
- }
-
bool get hasPartOfDirective {
return hasModifier(Modifier.HAS_PART_OF_DIRECTIVE);
}
@@ -3821,24 +3852,6 @@
return _imports;
}
- /// Set the specifications of all of the imports defined in this library to
- /// the given list of [imports].
- set imports(List<ImportElement> imports) {
- for (ImportElement importElement in imports) {
- (importElement as ImportElementImpl).enclosingElement = this;
- var prefix = importElement.prefix as PrefixElementImpl?;
- if (prefix != null) {
- prefix.enclosingElement = this;
- }
- }
- _imports = imports;
- _prefixes = null;
- }
-
- List<ImportElement> get imports_unresolved {
- return _imports;
- }
-
@override
bool get isBrowserApplication =>
entryPoint != null && isOrImportsBrowserLibrary;
@@ -4091,9 +4104,6 @@
@override
void visitChildren(ElementVisitor visitor) {
super.visitChildren(visitor);
- _definingCompilationUnit.accept(visitor);
- safelyVisitChildren(exports, visitor);
- safelyVisitChildren(imports, visitor);
safelyVisitChildren(_parts, visitor);
}
@@ -4139,6 +4149,134 @@
}
}
+/// A concrete implementation of a [LibraryOrAugmentationElement].
+abstract class LibraryOrAugmentationElementImpl extends ElementImpl
+ implements LibraryOrAugmentationElement, MacroTargetElementContainer {
+ /// The compilation unit that defines this library.
+ late CompilationUnitElementImpl _definingCompilationUnit;
+
+ List<AugmentationImportElement> _augmentationImports =
+ _Sentinel.augmentationImportElement;
+
+ /// A list containing specifications of all of the imports defined in this
+ /// library.
+ List<ImportElement> _imports = _Sentinel.importElement;
+
+ /// A list containing specifications of all of the exports defined in this
+ /// library.
+ List<ExportElement> _exports = _Sentinel.exportElement;
+
+ /// The cached list of prefixes.
+ List<PrefixElement>? _prefixes;
+
+ LibraryOrAugmentationElementImpl({
+ required String? name,
+ required int nameOffset,
+ }) : super(name, nameOffset);
+
+ @override
+ List<AugmentationImportElement> get augmentationImports {
+ return _augmentationImports;
+ }
+
+ set augmentationImports(List<AugmentationImportElement> imports) {
+ for (final importElement in imports) {
+ (importElement as AugmentationImportElementImpl).enclosingElement = this;
+ }
+ _augmentationImports = imports;
+ }
+
+ @override
+ CompilationUnitElementImpl get definingCompilationUnit =>
+ _definingCompilationUnit;
+
+ /// Set the compilation unit that defines this library to the given
+ /// compilation[unit].
+ set definingCompilationUnit(CompilationUnitElement unit) {
+ assert((unit as CompilationUnitElementImpl).librarySource == unit.source);
+ (unit as CompilationUnitElementImpl).enclosingElement = this;
+ _definingCompilationUnit = unit;
+ }
+
+ @override
+ CompilationUnitElementImpl get enclosingUnit {
+ return _definingCompilationUnit;
+ }
+
+ @override
+ List<ExportElement> get exports {
+ return _exports;
+ }
+
+ /// Set the specifications of all of the exports defined in this library to
+ /// the given list of [exports].
+ set exports(List<ExportElement> exports) {
+ for (ExportElement exportElement in exports) {
+ (exportElement as ExportElementImpl).enclosingElement = this;
+ }
+ _exports = exports;
+ }
+
+ List<ExportElement> get exports_unresolved {
+ return _exports;
+ }
+
+ @override
+ String get identifier => '${_definingCompilationUnit.source.uri}';
+
+ @override
+ List<ImportElement> get imports {
+ return _imports;
+ }
+
+ /// Set the specifications of all of the imports defined in this library to
+ /// the given list of [imports].
+ set imports(List<ImportElement> imports) {
+ for (ImportElement importElement in imports) {
+ (importElement as ImportElementImpl).enclosingElement = this;
+ var prefix = importElement.prefix as PrefixElementImpl?;
+ if (prefix != null) {
+ prefix.enclosingElement = this;
+ }
+ }
+ _imports = imports;
+ _prefixes = null;
+ }
+
+ List<ImportElement> get imports_unresolved {
+ return _imports;
+ }
+
+ @override
+ List<PrefixElement> get prefixes =>
+ _prefixes ??= buildPrefixesFromImports(imports);
+
+ @override
+ Source get source {
+ return _definingCompilationUnit.source;
+ }
+
+ @override
+ void visitChildren(ElementVisitor visitor) {
+ super.visitChildren(visitor);
+ _definingCompilationUnit.accept(visitor);
+ safelyVisitChildren(exports, visitor);
+ safelyVisitChildren(imports, visitor);
+ }
+
+ static List<PrefixElement> buildPrefixesFromImports(
+ List<ImportElement> imports) {
+ HashSet<PrefixElement> prefixes = HashSet<PrefixElement>();
+ for (ImportElement element in imports) {
+ var prefix = element.prefix;
+ if (prefix != null) {
+ prefixes.add(prefix);
+ }
+ }
+ return prefixes.toList(growable: false);
+ }
+}
+
/// A concrete implementation of a [LocalVariableElement].
class LocalVariableElementImpl extends NonParameterVariableElementImpl
implements LocalVariableElement {
@@ -4971,6 +5109,10 @@
super.enclosingElement as LibraryElement;
@override
+ LibraryOrAugmentationElementImpl get enclosingElement2 =>
+ super.enclosingElement as LibraryOrAugmentationElementImpl;
+
+ @override
ElementKind get kind => ElementKind.PREFIX;
@override
@@ -5994,6 +6136,8 @@
List.unmodifiable([]);
static final List<ExportElement> exportElement = List.unmodifiable([]);
static final List<FieldElement> fieldElement = List.unmodifiable([]);
+ static final List<AugmentationImportElement> augmentationImportElement =
+ List.unmodifiable([]);
static final List<ImportElement> importElement = List.unmodifiable([]);
static final List<MethodElement> methodElement = List.unmodifiable([]);
static final List<PropertyAccessorElement> propertyAccessorElement =
diff --git a/pkg/analyzer/lib/src/dart/element/extensions.dart b/pkg/analyzer/lib/src/dart/element/extensions.dart
index decbd59..f5c453d 100644
--- a/pkg/analyzer/lib/src/dart/element/extensions.dart
+++ b/pkg/analyzer/lib/src/dart/element/extensions.dart
@@ -82,7 +82,7 @@
}
return ancestor is CompilationUnitElement &&
- ancestor.enclosingElement.hasDoNotStore;
+ ancestor.enclosingElement2.hasDoNotStore;
}
/// Return `true` if this element is an instance member of a class or mixin.
diff --git a/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart b/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
index f0f8f69..ac40815 100644
--- a/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/resolve_for_completion_test.dart
@@ -28,12 +28,14 @@
var result = await _resolveTestCode(r'''
class A {
var f1 = 0;
- doub^ f2 = null;
+ dou^ f2 = null;
var f3 = 1;
}
''');
- result.assertResolvedNodes([]);
+ result.assertResolvedNodes([
+ 'dou f2 = null;',
+ ]);
}
test_class__fieldDeclaration_type_namedType_typeArgument_name() async {
@@ -48,6 +50,19 @@
result.assertResolvedNodes([]);
}
+ test_class_body_identifier_beforeFieldDeclaration() async {
+ var result = await _resolveTestCode(r'''
+class A {
+ foo^
+ int bar = 0;
+}
+''');
+
+ result.assertResolvedNodes([
+ 'foo int;',
+ ]);
+ }
+
test_class_extends_name() async {
var result = await _resolveTestCode(r'''
class A extends foo^ {}
diff --git a/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart b/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
index c34e500..3de528c 100644
--- a/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/results/get_element_declaration_test.dart
@@ -300,7 +300,7 @@
await resolveTestCode(r'''
library foo;
''');
- var element = findElement.unitElement.enclosingElement;
+ var element = this.result.libraryElement;
var result = await getElementDeclaration(element);
expect(result, isNull);
}
diff --git a/runtime/vm/app_snapshot.cc b/runtime/vm/app_snapshot.cc
index c5b8120..19054a2 100644
--- a/runtime/vm/app_snapshot.cc
+++ b/runtime/vm/app_snapshot.cc
@@ -4753,80 +4753,6 @@
};
#if !defined(DART_PRECOMPILED_RUNTIME)
-class Simd128SerializationCluster : public SerializationCluster {
- public:
- explicit Simd128SerializationCluster(intptr_t cid, bool is_canonical)
- : SerializationCluster("Simd128",
- cid,
- compiler::target::Int32x4::InstanceSize(),
- is_canonical) {
- ASSERT_EQUAL(compiler::target::Int32x4::InstanceSize(),
- compiler::target::Float32x4::InstanceSize());
- ASSERT_EQUAL(compiler::target::Int32x4::InstanceSize(),
- compiler::target::Float64x2::InstanceSize());
- }
- ~Simd128SerializationCluster() {}
-
- void Trace(Serializer* s, ObjectPtr object) { objects_.Add(object); }
-
- void WriteAlloc(Serializer* s) {
- const intptr_t count = objects_.length();
- s->WriteUnsigned(count);
- for (intptr_t i = 0; i < count; i++) {
- ObjectPtr vector = objects_[i];
- s->AssignRef(vector);
- }
- }
-
- void WriteFill(Serializer* s) {
- const intptr_t count = objects_.length();
- for (intptr_t i = 0; i < count; i++) {
- ObjectPtr vector = objects_[i];
- AutoTraceObject(vector);
- ASSERT_EQUAL(Int32x4::value_offset(), Float32x4::value_offset());
- ASSERT_EQUAL(Int32x4::value_offset(), Float64x2::value_offset());
- s->WriteBytes(&(static_cast<Int32x4Ptr>(vector)->untag()->value_),
- sizeof(simd128_value_t));
- }
- }
-
- private:
- GrowableArray<ObjectPtr> objects_;
-};
-#endif // !DART_PRECOMPILED_RUNTIME
-
-class Simd128DeserializationCluster
- : public AbstractInstanceDeserializationCluster {
- public:
- explicit Simd128DeserializationCluster(intptr_t cid, bool is_canonical)
- : AbstractInstanceDeserializationCluster("Simd128", is_canonical),
- cid_(cid) {}
- ~Simd128DeserializationCluster() {}
-
- void ReadAlloc(Deserializer* d) {
- ASSERT_EQUAL(Int32x4::InstanceSize(), Float32x4::InstanceSize());
- ASSERT_EQUAL(Int32x4::InstanceSize(), Float64x2::InstanceSize());
- ReadAllocFixedSize(d, Int32x4::InstanceSize());
- }
-
- void ReadFill(Deserializer* d_, bool primary) {
- Deserializer::Local d(d_);
- const intptr_t cid = cid_;
- const bool mark_canonical = primary && is_canonical();
- for (intptr_t id = start_index_, n = stop_index_; id < n; id++) {
- ObjectPtr vector = d.Ref(id);
- Deserializer::InitializeHeader(vector, cid, Int32x4::InstanceSize(),
- mark_canonical);
- d.ReadBytes(&(static_cast<Int32x4Ptr>(vector)->untag()->value_),
- sizeof(simd128_value_t));
- }
- }
-
- private:
- intptr_t cid_;
-};
-
-#if !defined(DART_PRECOMPILED_RUNTIME)
class GrowableObjectArraySerializationCluster : public SerializationCluster {
public:
GrowableObjectArraySerializationCluster()
@@ -6880,10 +6806,6 @@
return new (Z) MintSerializationCluster(is_canonical);
case kDoubleCid:
return new (Z) DoubleSerializationCluster(is_canonical);
- case kInt32x4Cid:
- case kFloat32x4Cid:
- case kFloat64x2Cid:
- return new (Z) Simd128SerializationCluster(cid, is_canonical);
case kGrowableObjectArrayCid:
return new (Z) GrowableObjectArraySerializationCluster();
case kStackTraceCid:
@@ -8038,10 +7960,6 @@
return new (Z) MintDeserializationCluster(is_canonical);
case kDoubleCid:
return new (Z) DoubleDeserializationCluster(is_canonical);
- case kInt32x4Cid:
- case kFloat32x4Cid:
- case kFloat64x2Cid:
- return new (Z) Simd128DeserializationCluster(cid, is_canonical);
case kGrowableObjectArrayCid:
ASSERT(!is_canonical);
return new (Z) GrowableObjectArrayDeserializationCluster();
diff --git a/runtime/vm/app_snapshot.h b/runtime/vm/app_snapshot.h
index 8d16572..0356e09 100644
--- a/runtime/vm/app_snapshot.h
+++ b/runtime/vm/app_snapshot.h
@@ -334,7 +334,7 @@
stream_->WriteWordWith32BitWrites(value);
}
- void WriteBytes(const void* addr, intptr_t len) {
+ void WriteBytes(const uint8_t* addr, intptr_t len) {
stream_->WriteBytes(addr, len);
}
void Align(intptr_t alignment) { stream_->Align(alignment); }
diff --git a/runtime/vm/compiler/assembler/assembler_arm64.h b/runtime/vm/compiler/assembler/assembler_arm64.h
index 9c31f77..e11ed94 100644
--- a/runtime/vm/compiler/assembler/assembler_arm64.h
+++ b/runtime/vm/compiler/assembler/assembler_arm64.h
@@ -1415,11 +1415,11 @@
void fcvtds(VRegister vd, VRegister vn) { EmitFPOneSourceOp(FCVTDS, vd, vn); }
void fldrq(VRegister vt, Address a) {
ASSERT(a.type() != Address::PCOffset);
- EmitLoadStoreReg(FLDRQ, static_cast<Register>(vt), a, kQWord);
+ EmitLoadStoreReg(FLDRQ, static_cast<Register>(vt), a, kByte);
}
void fstrq(VRegister vt, Address a) {
ASSERT(a.type() != Address::PCOffset);
- EmitLoadStoreReg(FSTRQ, static_cast<Register>(vt), a, kQWord);
+ EmitLoadStoreReg(FSTRQ, static_cast<Register>(vt), a, kByte);
}
void fldrd(VRegister vt, Address a) {
ASSERT(a.type() != Address::PCOffset);
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.cc b/runtime/vm/compiler/assembler/assembler_ia32.cc
index 3be2b7c..2ead117 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.cc
+++ b/runtime/vm/compiler/assembler/assembler_ia32.cc
@@ -2207,16 +2207,6 @@
addl(ESP, Immediate(2 * target::kWordSize));
}
-void Assembler::LoadQImmediate(XmmRegister dst, simd128_value_t value) {
- // TODO(5410843): Need to have a code constants table.
- pushl(Immediate(value.int_storage[3]));
- pushl(Immediate(value.int_storage[2]));
- pushl(Immediate(value.int_storage[1]));
- pushl(Immediate(value.int_storage[0]));
- movups(dst, Address(ESP, 0));
- addl(ESP, Immediate(4 * target::kWordSize));
-}
-
void Assembler::FloatNegate(XmmRegister f) {
static const struct ALIGN16 {
uint32_t a;
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index d15f736..48f6a49 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -748,7 +748,6 @@
}
void LoadDImmediate(XmmRegister dst, double value);
- void LoadQImmediate(XmmRegister dst, simd128_value_t value);
void Drop(intptr_t stack_elements);
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index 93cf612..a6b8720 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -2988,22 +2988,6 @@
return unbox_defn->value()->definition();
}
- if (value()->BindsToConstant()) {
- switch (representation()) {
- case kUnboxedFloat64x2:
- ASSERT(value()->BoundConstant().IsFloat64x2());
- return flow_graph->GetConstant(value()->BoundConstant(), kTagged);
- case kUnboxedFloat32x4:
- ASSERT(value()->BoundConstant().IsFloat32x4());
- return flow_graph->GetConstant(value()->BoundConstant(), kTagged);
- case kUnboxedInt32x4:
- ASSERT(value()->BoundConstant().IsInt32x4());
- return flow_graph->GetConstant(value()->BoundConstant(), kTagged);
- default:
- return this;
- }
- }
-
return this;
}
@@ -7274,53 +7258,6 @@
return simd_op_information[kind()].has_mask;
}
-Definition* SimdOpInstr::Canonicalize(FlowGraph* flow_graph) {
- if ((kind() == SimdOpInstr::kFloat64x2FromDoubles) &&
- InputAt(0)->BindsToConstant() && InputAt(1)->BindsToConstant()) {
- const Object& x = InputAt(0)->BoundConstant();
- const Object& y = InputAt(1)->BoundConstant();
- if (x.IsDouble() && y.IsDouble()) {
- Float64x2& result = Float64x2::ZoneHandle(Float64x2::New(
- Double::Cast(x).value(), Double::Cast(y).value(), Heap::kOld));
- result ^= result.Canonicalize(Thread::Current());
- return flow_graph->GetConstant(result, kUnboxedFloat64x2);
- }
- }
- if ((kind() == SimdOpInstr::kFloat32x4FromDoubles) &&
- InputAt(0)->BindsToConstant() && InputAt(1)->BindsToConstant() &&
- InputAt(2)->BindsToConstant() && InputAt(3)->BindsToConstant()) {
- const Object& x = InputAt(0)->BoundConstant();
- const Object& y = InputAt(1)->BoundConstant();
- const Object& z = InputAt(2)->BoundConstant();
- const Object& w = InputAt(3)->BoundConstant();
- if (x.IsDouble() && y.IsDouble() && z.IsDouble() && w.IsDouble()) {
- Float32x4& result = Float32x4::Handle(Float32x4::New(
- Double::Cast(x).value(), Double::Cast(y).value(),
- Double::Cast(z).value(), Double::Cast(w).value(), Heap::kOld));
- result ^= result.Canonicalize(Thread::Current());
- return flow_graph->GetConstant(result, kUnboxedFloat32x4);
- }
- }
- if ((kind() == SimdOpInstr::kInt32x4FromInts) &&
- InputAt(0)->BindsToConstant() && InputAt(1)->BindsToConstant() &&
- InputAt(2)->BindsToConstant() && InputAt(3)->BindsToConstant()) {
- const Object& x = InputAt(0)->BoundConstant();
- const Object& y = InputAt(1)->BoundConstant();
- const Object& z = InputAt(2)->BoundConstant();
- const Object& w = InputAt(3)->BoundConstant();
- if (x.IsInteger() && y.IsInteger() && z.IsInteger() && w.IsInteger()) {
- Int32x4& result = Int32x4::Handle(Int32x4::New(
- Integer::Cast(x).AsInt64Value(), Integer::Cast(y).AsInt64Value(),
- Integer::Cast(z).AsInt64Value(), Integer::Cast(w).AsInt64Value(),
- Heap::kOld));
- result ^= result.Canonicalize(Thread::Current());
- return flow_graph->GetConstant(result, kUnboxedInt32x4);
- }
- }
-
- return this;
-}
-
LocationSummary* Call1ArgStubInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 5369c46..55899ac 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -9531,8 +9531,6 @@
(!HasMask() || mask() == other_op->mask());
}
- virtual Definition* Canonicalize(FlowGraph* flow_graph);
-
DECLARE_INSTRUCTION(SimdOp)
PRINT_OPERANDS_TO_SUPPORT
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index 12d26f5..0f1784c 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -696,48 +696,25 @@
__ LoadObject(destination.reg(), value_);
}
} else if (destination.IsFpuRegister()) {
- switch (representation()) {
- case kUnboxedDouble:
- ASSERT(tmp != kNoRegister);
- __ LoadDImmediate(EvenDRegisterOf(destination.fpu_reg()),
- Double::Cast(value_).value(), tmp);
- break;
- case kUnboxedFloat64x2:
- __ LoadQImmediate(destination.fpu_reg(),
- Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(destination.fpu_reg(),
- Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(destination.fpu_reg(), Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
+ const DRegister dst = EvenDRegisterOf(destination.fpu_reg());
+ if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0) &&
+ TargetCPUFeatures::neon_supported()) {
+ QRegister qdst = destination.fpu_reg();
+ __ veorq(qdst, qdst, qdst);
+ } else {
+ ASSERT(tmp != kNoRegister);
+ __ LoadDImmediate(dst, Double::Cast(value_).value(), tmp);
}
} else if (destination.IsDoubleStackSlot()) {
- ASSERT(tmp != kNoRegister);
- __ LoadDImmediate(DTMP, Double::Cast(value_).value(), tmp);
- const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ StoreDToOffset(DTMP, destination.base_reg(), dest_offset);
- } else if (destination.IsQuadStackSlot()) {
- switch (representation()) {
- case kUnboxedFloat64x2:
- __ LoadQImmediate(QTMP, Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(QTMP, Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(QTMP, Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
+ if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0) &&
+ TargetCPUFeatures::neon_supported()) {
+ __ veorq(QTMP, QTMP, QTMP);
+ } else {
+ ASSERT(tmp != kNoRegister);
+ __ LoadDImmediate(DTMP, Double::Cast(value_).value(), tmp);
}
const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ StoreMultipleDToOffset(EvenDRegisterOf(QTMP), 2, destination.base_reg(),
- dest_offset);
+ __ StoreDToOffset(DTMP, destination.base_reg(), dest_offset);
} else {
ASSERT(destination.IsStackSlot());
ASSERT(tmp != kNoRegister);
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index a49d693..ac442ee 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -612,42 +612,17 @@
__ LoadObject(destination.reg(), value_);
}
} else if (destination.IsFpuRegister()) {
- switch (representation()) {
- case kUnboxedDouble:
- __ LoadDImmediate(destination.fpu_reg(), Double::Cast(value_).value());
- break;
- case kUnboxedFloat64x2:
- __ LoadQImmediate(destination.fpu_reg(),
- Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(destination.fpu_reg(),
- Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(destination.fpu_reg(), Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
+ const VRegister dst = destination.fpu_reg();
+ if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0)) {
+ __ veor(dst, dst, dst);
+ } else {
+ __ LoadDImmediate(dst, Double::Cast(value_).value());
}
} else if (destination.IsDoubleStackSlot()) {
- ASSERT(representation() == kUnboxedDouble);
- __ LoadDImmediate(VTMP, Double::Cast(value_).value());
- const intptr_t dest_offset = destination.ToStackSlotOffset();
- __ StoreDToOffset(VTMP, destination.base_reg(), dest_offset);
- } else if (destination.IsQuadStackSlot()) {
- switch (representation()) {
- case kUnboxedFloat64x2:
- __ LoadQImmediate(VTMP, Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(VTMP, Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(VTMP, Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
+ if (Utils::DoublesBitEqual(Double::Cast(value_).value(), 0.0)) {
+ __ veor(VTMP, VTMP, VTMP);
+ } else {
+ __ LoadDImmediate(VTMP, Double::Cast(value_).value());
}
const intptr_t dest_offset = destination.ToStackSlotOffset();
__ StoreDToOffset(VTMP, destination.base_reg(), dest_offset);
diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc
index 5b044a0..1915491 100644
--- a/runtime/vm/compiler/backend/il_ia32.cc
+++ b/runtime/vm/compiler/backend/il_ia32.cc
@@ -420,36 +420,18 @@
__ LoadObjectSafely(destination.reg(), value_);
}
} else if (destination.IsFpuRegister()) {
- switch (representation()) {
- case kUnboxedDouble: {
- const double value_as_double = Double::Cast(value_).value();
- uword addr = FindDoubleConstant(value_as_double);
- if (addr == 0) {
- __ pushl(EAX);
- __ LoadObject(EAX, value_);
- __ movsd(destination.fpu_reg(),
- compiler::FieldAddress(EAX, Double::value_offset()));
- __ popl(EAX);
- } else if (Utils::DoublesBitEqual(value_as_double, 0.0)) {
- __ xorps(destination.fpu_reg(), destination.fpu_reg());
- } else {
- __ movsd(destination.fpu_reg(), compiler::Address::Absolute(addr));
- }
- break;
- }
- case kUnboxedFloat64x2:
- __ LoadQImmediate(destination.fpu_reg(),
- Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(destination.fpu_reg(),
- Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(destination.fpu_reg(), Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
+ const double value_as_double = Double::Cast(value_).value();
+ uword addr = FindDoubleConstant(value_as_double);
+ if (addr == 0) {
+ __ pushl(EAX);
+ __ LoadObject(EAX, value_);
+ __ movsd(destination.fpu_reg(),
+ compiler::FieldAddress(EAX, Double::value_offset()));
+ __ popl(EAX);
+ } else if (Utils::DoublesBitEqual(value_as_double, 0.0)) {
+ __ xorps(destination.fpu_reg(), destination.fpu_reg());
+ } else {
+ __ movsd(destination.fpu_reg(), compiler::Address::Absolute(addr));
}
} else if (destination.IsDoubleStackSlot()) {
const double value_as_double = Double::Cast(value_).value();
@@ -465,21 +447,6 @@
__ movsd(FpuTMP, compiler::Address::Absolute(addr));
}
__ movsd(LocationToStackSlotAddress(destination), FpuTMP);
- } else if (destination.IsQuadStackSlot()) {
- switch (representation()) {
- case kUnboxedFloat64x2:
- __ LoadQImmediate(FpuTMP, Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(FpuTMP, Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(FpuTMP, Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
- }
- __ movups(LocationToStackSlotAddress(destination), FpuTMP);
} else {
ASSERT(destination.IsStackSlot());
if (RepresentationUtils::IsUnboxedInteger(representation())) {
diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc
index e086250..b6b58ce 100644
--- a/runtime/vm/compiler/backend/il_x64.cc
+++ b/runtime/vm/compiler/backend/il_x64.cc
@@ -566,43 +566,10 @@
__ LoadObject(destination.reg(), value_);
}
} else if (destination.IsFpuRegister()) {
- switch (representation()) {
- case kUnboxedDouble:
- __ LoadDImmediate(destination.fpu_reg(), Double::Cast(value_).value());
- break;
- case kUnboxedFloat64x2:
- __ LoadQImmediate(destination.fpu_reg(),
- Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(destination.fpu_reg(),
- Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(destination.fpu_reg(), Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
- }
+ __ LoadDImmediate(destination.fpu_reg(), Double::Cast(value_).value());
} else if (destination.IsDoubleStackSlot()) {
- ASSERT(representation() == kUnboxedDouble);
__ LoadDImmediate(FpuTMP, Double::Cast(value_).value());
__ movsd(LocationToStackSlotAddress(destination), FpuTMP);
- } else if (destination.IsQuadStackSlot()) {
- switch (representation()) {
- case kUnboxedFloat64x2:
- __ LoadQImmediate(FpuTMP, Float64x2::Cast(value_).value());
- break;
- case kUnboxedFloat32x4:
- __ LoadQImmediate(FpuTMP, Float32x4::Cast(value_).value());
- break;
- case kUnboxedInt32x4:
- __ LoadQImmediate(FpuTMP, Int32x4::Cast(value_).value());
- break;
- default:
- UNREACHABLE();
- }
- __ movups(LocationToStackSlotAddress(destination), FpuTMP);
} else {
ASSERT(destination.IsStackSlot());
if (RepresentationUtils::IsUnboxedInteger(representation())) {
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 5b11a2b..deae310 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -24954,16 +24954,6 @@
return untag()->value_[3];
}
-bool Float32x4::CanonicalizeEquals(const Instance& other) const {
- return memcmp(&untag()->value_, Float32x4::Cast(other).untag()->value_,
- sizeof(simd128_value_t)) == 0;
-}
-
-uint32_t Float32x4::CanonicalizeHash() const {
- return HashBytes(reinterpret_cast<const uint8_t*>(&untag()->value_),
- sizeof(simd128_value_t));
-}
-
const char* Float32x4::ToCString() const {
float _x = x();
float _y = y();
@@ -25052,16 +25042,6 @@
value);
}
-bool Int32x4::CanonicalizeEquals(const Instance& other) const {
- return memcmp(&untag()->value_, Int32x4::Cast(other).untag()->value_,
- sizeof(simd128_value_t)) == 0;
-}
-
-uint32_t Int32x4::CanonicalizeHash() const {
- return HashBytes(reinterpret_cast<const uint8_t*>(&untag()->value_),
- sizeof(simd128_value_t));
-}
-
const char* Int32x4::ToCString() const {
int32_t _x = x();
int32_t _y = y();
@@ -25126,16 +25106,6 @@
StoreSimd128(&untag()->value_[0], value);
}
-bool Float64x2::CanonicalizeEquals(const Instance& other) const {
- return memcmp(&untag()->value_, Float64x2::Cast(other).untag()->value_,
- sizeof(simd128_value_t)) == 0;
-}
-
-uint32_t Float64x2::CanonicalizeHash() const {
- return HashBytes(reinterpret_cast<const uint8_t*>(&untag()->value_),
- sizeof(simd128_value_t));
-}
-
const char* Float64x2::ToCString() const {
double _x = x();
double _y = y();
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index d42fba8..6f226c3 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -10669,9 +10669,6 @@
return OFFSET_OF(UntaggedFloat32x4, value_);
}
- virtual bool CanonicalizeEquals(const Instance& other) const;
- virtual uint32_t CanonicalizeHash() const;
-
private:
FINAL_HEAP_OBJECT_IMPLEMENTATION(Float32x4, Instance);
friend class Class;
@@ -10705,9 +10702,6 @@
static intptr_t value_offset() { return OFFSET_OF(UntaggedInt32x4, value_); }
- virtual bool CanonicalizeEquals(const Instance& other) const;
- virtual uint32_t CanonicalizeHash() const;
-
private:
FINAL_HEAP_OBJECT_IMPLEMENTATION(Int32x4, Instance);
friend class Class;
@@ -10738,9 +10732,6 @@
return OFFSET_OF(UntaggedFloat64x2, value_);
}
- virtual bool CanonicalizeEquals(const Instance& other) const;
- virtual uint32_t CanonicalizeHash() const;
-
private:
FINAL_HEAP_OBJECT_IMPLEMENTATION(Float64x2, Instance);
friend class Class;
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index d7913cf..f490865 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -3157,10 +3157,8 @@
ALIGN8 int32_t value_[4];
- friend class Simd128DeserializationCluster;
- friend class Simd128MessageDeserializationCluster;
friend class Simd128MessageSerializationCluster;
- friend class Simd128SerializationCluster;
+ friend class Simd128MessageDeserializationCluster;
public:
int32_t x() const { return value_[0]; }
diff --git a/tools/VERSION b/tools/VERSION
index b7332b4..7016b5b 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 18
PATCH 0
-PRERELEASE 110
+PRERELEASE 111
PRERELEASE_PATCH 0
\ No newline at end of file