| // Copyright (c) 2024, 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:test/test.dart'; |
| import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| |
| import '../../dart/resolution/node_text_expectations.dart'; |
| import '../elements_base.dart'; |
| |
| main() { |
| defineReflectiveSuite(() { |
| defineReflectiveTests(ClassElementTest_keepLinking); |
| defineReflectiveTests(ClassElementTest_fromBytes); |
| // TODO(scheglov): implement augmentation |
| // defineReflectiveTests(ClassElementTest_augmentation_keepLinking); |
| // defineReflectiveTests(ClassElementTest_augmentation_fromBytes); |
| defineReflectiveTests(UpdateNodeTextExpectations); |
| }); |
| } |
| |
| abstract class ClassElementTest extends ElementsBaseTest { |
| test_class_abstract() async { |
| var library = await buildLibrary('abstract class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_base() async { |
| var library = await buildLibrary('base class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @11 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| base class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_const() async { |
| var library = await buildLibrary('class C { const C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 16 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_const_external() async { |
| var library = await buildLibrary('class C { external const C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 external const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 25 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| external const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_documented() async { |
| var library = await buildLibrary(''' |
| class C { |
| /** |
| * Docs |
| */ |
| C(); |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| documentationComment: /**\n * Docs\n */ |
| typeName: C |
| typeNameOffset: 34 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| documentationComment: /**\n * Docs\n */ |
| '''); |
| } |
| |
| test_class_constructor_explicit_named() async { |
| var library = await buildLibrary('class C { C.foo(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 foo @12 |
| element: <testLibrary>::@class::C::@constructor::foo |
| typeName: C |
| typeNameOffset: 10 |
| periodOffset: 11 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| foo |
| reference: <testLibrary>::@class::C::@constructor::foo |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_explicit_type_params() async { |
| var library = await buildLibrary('class C<T, U> { C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 16 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_constructor_explicit_unnamed() async { |
| var library = await buildLibrary('class C { C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 10 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_external() async { |
| var library = await buildLibrary('class C { external C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 external new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 19 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| external new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_factory() async { |
| var library = await buildLibrary('class C { factory C() => throw 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_field_formal_dynamic_dynamic() async { |
| var library = await buildLibrary( |
| 'class C { dynamic x; C(dynamic this.x); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| formalParameters |
| #F4 this.x @36 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: dynamic |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_dynamic_typed() async { |
| var library = await buildLibrary('class C { dynamic x; C(int this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| formalParameters |
| #F4 this.x @32 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_dynamic_untyped() async { |
| var library = await buildLibrary('class C { dynamic x; C(this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| formalParameters |
| #F4 this.x @28 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: dynamic |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_functionTyped_noReturnType() async { |
| var library = await buildLibrary(r''' |
| class C { |
| var x; |
| C(this.x(double b)); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @16 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| formalParameters |
| #F4 this.x @28 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: dynamic Function(double) |
| formalParameters |
| requiredPositional b |
| firstFragment: #F8 |
| type: double |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_functionTyped_withReturnType() async { |
| var library = await buildLibrary(r''' |
| class C { |
| var x; |
| C(int this.x(double b)); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @16 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| formalParameters |
| #F4 this.x @32 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: int Function(double) |
| formalParameters |
| requiredPositional b |
| firstFragment: #F8 |
| type: double |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_functionTyped_withReturnType_generic() async { |
| var library = await buildLibrary(r''' |
| class C { |
| Function() f; |
| C(List<U> this.f<T, U>(T t)); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 f @23 |
| element: <testLibrary>::@class::C::@field::f |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 28 |
| formalParameters |
| #F4 this.f @43 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::f |
| getters |
| #F5 synthetic f |
| element: <testLibrary>::@class::C::@getter::f |
| returnType: dynamic Function() |
| setters |
| #F6 synthetic f |
| element: <testLibrary>::@class::C::@setter::f |
| formalParameters |
| #F7 _f |
| element: <testLibrary>::@class::C::@setter::f::@formalParameter::_f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| f |
| reference: <testLibrary>::@class::C::@field::f |
| firstFragment: #F2 |
| type: dynamic Function() |
| getter: <testLibrary>::@class::C::@getter::f |
| setter: <testLibrary>::@class::C::@setter::f |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final f |
| firstFragment: #F4 |
| type: List<U> Function<T, U>(T) |
| typeParameters |
| #E0 T |
| firstFragment: #F8 |
| #E1 U |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F10 |
| type: T |
| getters |
| synthetic f |
| reference: <testLibrary>::@class::C::@getter::f |
| firstFragment: #F5 |
| returnType: dynamic Function() |
| variable: <testLibrary>::@class::C::@field::f |
| setters |
| synthetic f |
| reference: <testLibrary>::@class::C::@setter::f |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _f |
| firstFragment: #F7 |
| type: dynamic Function() |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_multiple_matching_fields() async { |
| // This is a compile-time error but it should still analyze consistently. |
| var library = await buildLibrary('class C { C(this.x); int x; String x; }'); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @25 |
| element: <testLibrary>::@class::C::@field::x::@def::0 |
| #F3 x @35 |
| element: <testLibrary>::@class::C::@field::x::@def::1 |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 10 |
| formalParameters |
| #F5 this.x @17 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@getter::x::@def::0 |
| returnType: int |
| #F7 synthetic x |
| element: <testLibrary>::@class::C::@getter::x::@def::1 |
| returnType: String |
| setters |
| #F8 synthetic x |
| element: <testLibrary>::@class::C::@setter::x::@def::0 |
| formalParameters |
| #F9 _x |
| element: <testLibrary>::@class::C::@setter::x::@def::0::@formalParameter::_x |
| #F10 synthetic x |
| element: <testLibrary>::@class::C::@setter::x::@def::1 |
| formalParameters |
| #F11 _x |
| element: <testLibrary>::@class::C::@setter::x::@def::1::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x::@def::0 |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x::@def::0 |
| setter: <testLibrary>::@class::C::@setter::x::@def::0 |
| x |
| reference: <testLibrary>::@class::C::@field::x::@def::1 |
| firstFragment: #F3 |
| type: String |
| getter: <testLibrary>::@class::C::@getter::x::@def::1 |
| setter: <testLibrary>::@class::C::@setter::x::@def::1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F5 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x::@def::0 |
| firstFragment: #F6 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x::@def::0 |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x::@def::1 |
| firstFragment: #F7 |
| returnType: String |
| variable: <testLibrary>::@class::C::@field::x::@def::1 |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x::@def::0 |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F9 |
| type: int |
| returnType: void |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x::@def::1 |
| firstFragment: #F10 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F11 |
| type: String |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_no_matching_field() async { |
| // This is a compile-time error but it should still analyze consistently. |
| var library = await buildLibrary('class C { C(this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 10 |
| formalParameters |
| #F3 this.x @17 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F3 |
| type: dynamic |
| '''); |
| } |
| |
| test_class_constructor_field_formal_typed_dynamic() async { |
| var library = await buildLibrary('class C { num x; C(dynamic this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @32 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: num |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: num |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: dynamic |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: num |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: num |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_typed_typed() async { |
| var library = await buildLibrary('class C { num x; C(int this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @28 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: num |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: num |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: num |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: num |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_typed_untyped() async { |
| var library = await buildLibrary('class C { num x; C(this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @24 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: num |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: num |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: num |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: num |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: num |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_untyped_dynamic() async { |
| var library = await buildLibrary('class C { var x; C(dynamic this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @32 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: dynamic |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_untyped_typed() async { |
| var library = await buildLibrary('class C { var x; C(int this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @28 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final x |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_field_formal_untyped_untyped() async { |
| var library = await buildLibrary('class C { var x; C(this.x); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @24 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: dynamic |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_fieldFormal_named_noDefault() async { |
| var library = await buildLibrary('class C { int x; C({this.x}); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @25 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| optionalNamed final hasImplicitType x |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_fieldFormal_named_withDefault() async { |
| var library = await buildLibrary('class C { int x; C({this.x: 42}); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @25 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 42 @28 |
| staticType: int |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| optionalNamed final hasImplicitType x |
| firstFragment: #F4 |
| type: int |
| constantInitializer |
| fragment: #F4 |
| expression: expression_0 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_fieldFormal_optional_noDefault() async { |
| var library = await buildLibrary('class C { int x; C([this.x]); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @25 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| optionalPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_fieldFormal_optional_withDefault() async { |
| var library = await buildLibrary('class C { int x; C([this.x = 42]); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 17 |
| formalParameters |
| #F4 this.x @25 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 42 @29 |
| staticType: int |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F6 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F7 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| optionalPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: int |
| constantInitializer |
| fragment: #F4 |
| expression: expression_0 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_implicit_type_params() async { |
| var library = await buildLibrary('class C<T, U> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_constructor_initializers_assertInvocation() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C(int x) : assert(x >= 42); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| formalParameters |
| #F3 x @24 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F3 |
| type: int |
| constantInitializers |
| AssertInitializer |
| assertKeyword: assert @29 |
| leftParenthesis: ( @35 |
| condition: BinaryExpression |
| leftOperand: SimpleIdentifier |
| token: x @36 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| staticType: int |
| operator: >= @38 |
| rightOperand: IntegerLiteral |
| literal: 42 @41 |
| staticType: int |
| element: dart:core::@class::num::@method::>= |
| staticInvokeType: bool Function(num) |
| staticType: bool |
| rightParenthesis: ) @43 |
| '''); |
| } |
| |
| test_class_constructor_initializers_assertInvocation_message() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C(int x) : assert(x >= 42, 'foo'); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| formalParameters |
| #F3 x @24 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F3 |
| type: int |
| constantInitializers |
| AssertInitializer |
| assertKeyword: assert @29 |
| leftParenthesis: ( @35 |
| condition: BinaryExpression |
| leftOperand: SimpleIdentifier |
| token: x @36 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| staticType: int |
| operator: >= @38 |
| rightOperand: IntegerLiteral |
| literal: 42 @41 |
| staticType: int |
| element: dart:core::@class::num::@method::>= |
| staticInvokeType: bool Function(num) |
| staticType: bool |
| comma: , @43 |
| message: SimpleStringLiteral |
| literal: 'foo' @45 |
| rightParenthesis: ) @50 |
| '''); |
| } |
| |
| test_class_constructor_initializers_field() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x; |
| const C() : x = 42; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 29 |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @35 |
| element: <testLibrary>::@class::C::@field::x |
| staticType: null |
| equals: = @37 |
| expression: IntegerLiteral |
| literal: 42 @39 |
| staticType: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_constructor_initializers_field_notConst() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x; |
| const C() : x = foo(); |
| } |
| int foo() => 42; |
| '''); |
| // It is OK to keep non-constant initializers. |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 29 |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| functions |
| #F5 foo @52 |
| element: <testLibrary>::@function::foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @35 |
| element: <testLibrary>::@class::C::@field::x |
| staticType: null |
| equals: = @37 |
| expression: MethodInvocation |
| methodName: SimpleIdentifier |
| token: foo @39 |
| element: <testLibrary>::@function::foo |
| staticType: int Function() |
| argumentList: ArgumentList |
| leftParenthesis: ( @42 |
| rightParenthesis: ) @43 |
| staticInvokeType: int Function() |
| staticType: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| functions |
| foo |
| reference: <testLibrary>::@function::foo |
| firstFragment: #F5 |
| returnType: int |
| '''); |
| } |
| |
| test_class_constructor_initializers_field_optionalPositionalParameter() async { |
| var library = await buildLibrary(''' |
| class A { |
| final int _f; |
| const A([int f = 0]) : _f = f; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 _f @22 |
| element: <testLibrary>::@class::A::@field::_f |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 34 |
| formalParameters |
| #F4 f @41 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::f |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @45 |
| staticType: int |
| getters |
| #F5 synthetic _f |
| element: <testLibrary>::@class::A::@getter::_f |
| returnType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| final promotable _f |
| reference: <testLibrary>::@class::A::@field::_f |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::_f |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| optionalPositional f |
| firstFragment: #F4 |
| type: int |
| constantInitializer |
| fragment: #F4 |
| expression: expression_0 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: _f @51 |
| element: <testLibrary>::@class::A::@field::_f |
| staticType: null |
| equals: = @54 |
| expression: SimpleIdentifier |
| token: f @56 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::f |
| staticType: int |
| getters |
| synthetic _f |
| reference: <testLibrary>::@class::A::@getter::_f |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::_f |
| '''); |
| } |
| |
| test_class_constructor_initializers_field_recordLiteral() async { |
| var library = await buildLibrary(''' |
| class C { |
| final Object x; |
| const C(int a) : x = (0, a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @25 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 36 |
| formalParameters |
| #F4 a @42 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: Object |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: Object |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F4 |
| type: int |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @47 |
| element: <testLibrary>::@class::C::@field::x |
| staticType: null |
| equals: = @49 |
| expression: RecordLiteral |
| leftParenthesis: ( @51 |
| fields |
| IntegerLiteral |
| literal: 0 @52 |
| staticType: int |
| SimpleIdentifier |
| token: a @55 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a |
| staticType: int |
| rightParenthesis: ) @56 |
| staticType: (int, int) |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: Object |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_constructor_initializers_field_withParameter() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x; |
| const C(int p) : x = 1 + p; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 29 |
| formalParameters |
| #F4 p @35 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::p |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional p |
| firstFragment: #F4 |
| type: int |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @40 |
| element: <testLibrary>::@class::C::@field::x |
| staticType: null |
| equals: = @42 |
| expression: BinaryExpression |
| leftOperand: IntegerLiteral |
| literal: 1 @44 |
| staticType: int |
| operator: + @46 |
| rightOperand: SimpleIdentifier |
| token: p @48 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::p |
| staticType: int |
| element: dart:core::@class::num::@method::+ |
| staticInvokeType: num Function(num) |
| staticType: int |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_constructor_initializers_genericFunctionType() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A(); |
| } |
| class B { |
| const B(dynamic x); |
| const B.f() |
| : this(A<Function()>()); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 21 |
| #F4 class B @34 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 46 |
| formalParameters |
| #F6 x @56 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x |
| #F7 const f @70 |
| element: <testLibrary>::@class::B::@constructor::f |
| typeName: B |
| typeNameOffset: 68 |
| periodOffset: 69 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F6 |
| type: dynamic |
| const f |
| reference: <testLibrary>::@class::B::@constructor::f |
| firstFragment: #F7 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @79 |
| argumentList: ArgumentList |
| leftParenthesis: ( @83 |
| arguments |
| InstanceCreationExpression |
| constructorName: ConstructorName |
| type: NamedType |
| name: A @84 |
| typeArguments: TypeArgumentList |
| leftBracket: < @85 |
| arguments |
| GenericFunctionType |
| functionKeyword: Function @86 |
| parameters: FormalParameterList |
| leftParenthesis: ( @94 |
| rightParenthesis: ) @95 |
| declaredElement: GenericFunctionTypeElement |
| parameters |
| returnType: dynamic |
| type: dynamic Function() |
| type: dynamic Function() |
| rightBracket: > @96 |
| element2: <testLibrary>::@class::A |
| type: A<dynamic Function()> |
| element: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: dynamic Function()} |
| argumentList: ArgumentList |
| leftParenthesis: ( @97 |
| rightParenthesis: ) @98 |
| staticType: A<dynamic Function()> |
| rightParenthesis: ) @99 |
| element: <testLibrary>::@class::B::@constructor::new |
| redirectedConstructor: <testLibrary>::@class::B::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_initializers_superInvocation_argumentContextType() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A(List<String> values); |
| } |
| class B extends A { |
| const B() : super(const []); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 18 |
| formalParameters |
| #F3 values @33 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::values |
| #F4 class B @50 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 72 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional values |
| firstFragment: #F3 |
| type: List<String> |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @78 |
| argumentList: ArgumentList |
| leftParenthesis: ( @83 |
| arguments |
| ListLiteral |
| constKeyword: const @84 |
| leftBracket: [ @90 |
| rightBracket: ] @91 |
| staticType: List<String> |
| rightParenthesis: ) @92 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_initializers_superInvocation_named() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A.aaa(int p); |
| } |
| class C extends A { |
| const C() : super.aaa(42); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const aaa @20 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| typeName: A |
| typeNameOffset: 18 |
| periodOffset: 19 |
| formalParameters |
| #F3 p @28 |
| element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::p |
| #F4 class C @40 |
| element: <testLibrary>::@class::C |
| constructors |
| #F5 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 62 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const aaa |
| reference: <testLibrary>::@class::A::@constructor::aaa |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional p |
| firstFragment: #F3 |
| type: int |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @68 |
| period: . @73 |
| constructorName: SimpleIdentifier |
| token: aaa @74 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @77 |
| arguments |
| IntegerLiteral |
| literal: 42 @78 |
| staticType: int |
| rightParenthesis: ) @80 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| superConstructor: <testLibrary>::@class::A::@constructor::aaa |
| '''); |
| } |
| |
| test_class_constructor_initializers_superInvocation_named_underscore() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A._(); |
| } |
| class B extends A { |
| const B() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const _ @20 |
| element: <testLibrary>::@class::A::@constructor::_ |
| typeName: A |
| typeNameOffset: 18 |
| periodOffset: 19 |
| #F3 class B @33 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 55 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const _ |
| reference: <testLibrary>::@class::A::@constructor::_ |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @61 |
| period: . @66 |
| constructorName: SimpleIdentifier |
| token: _ @67 |
| element: <testLibrary>::@class::A::@constructor::_ |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @68 |
| rightParenthesis: ) @69 |
| element: <testLibrary>::@class::A::@constructor::_ |
| superConstructor: <testLibrary>::@class::A::@constructor::_ |
| '''); |
| } |
| |
| test_class_constructor_initializers_superInvocation_namedExpression() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A.aaa(a, {int b}); |
| } |
| class C extends A { |
| const C() : super.aaa(1, b: 2); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const aaa @20 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| typeName: A |
| typeNameOffset: 18 |
| periodOffset: 19 |
| formalParameters |
| #F3 a @24 |
| element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::a |
| #F4 b @32 |
| element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::b |
| #F5 class C @45 |
| element: <testLibrary>::@class::C |
| constructors |
| #F6 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 67 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const aaa |
| reference: <testLibrary>::@class::A::@constructor::aaa |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional hasImplicitType a |
| firstFragment: #F3 |
| type: dynamic |
| optionalNamed b |
| firstFragment: #F4 |
| type: int |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F5 |
| supertype: A |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F6 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @73 |
| period: . @78 |
| constructorName: SimpleIdentifier |
| token: aaa @79 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @82 |
| arguments |
| IntegerLiteral |
| literal: 1 @83 |
| staticType: int |
| NamedExpression |
| name: Label |
| label: SimpleIdentifier |
| token: b @86 |
| element: <testLibrary>::@class::A::@constructor::aaa::@formalParameter::b |
| staticType: null |
| colon: : @87 |
| expression: IntegerLiteral |
| literal: 2 @89 |
| staticType: int |
| rightParenthesis: ) @90 |
| element: <testLibrary>::@class::A::@constructor::aaa |
| superConstructor: <testLibrary>::@class::A::@constructor::aaa |
| '''); |
| } |
| |
| test_class_constructor_initializers_superInvocation_unnamed() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A(int p); |
| } |
| class C extends A { |
| const C.ccc() : super(42); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 18 |
| formalParameters |
| #F3 p @24 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::p |
| #F4 class C @36 |
| element: <testLibrary>::@class::C |
| constructors |
| #F5 const ccc @60 |
| element: <testLibrary>::@class::C::@constructor::ccc |
| typeName: C |
| typeNameOffset: 58 |
| periodOffset: 59 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional p |
| firstFragment: #F3 |
| type: int |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| const ccc |
| reference: <testLibrary>::@class::C::@constructor::ccc |
| firstFragment: #F5 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @68 |
| argumentList: ArgumentList |
| leftParenthesis: ( @73 |
| arguments |
| IntegerLiteral |
| literal: 42 @74 |
| staticType: int |
| rightParenthesis: ) @76 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_initializers_thisInvocation_argumentContextType() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A(List<String> values); |
| const A.empty() : this(const []); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 18 |
| formalParameters |
| #F3 values @33 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::values |
| #F4 const empty @52 |
| element: <testLibrary>::@class::A::@constructor::empty |
| typeName: A |
| typeNameOffset: 50 |
| periodOffset: 51 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional values |
| firstFragment: #F3 |
| type: List<String> |
| const empty |
| reference: <testLibrary>::@class::A::@constructor::empty |
| firstFragment: #F4 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @62 |
| argumentList: ArgumentList |
| leftParenthesis: ( @66 |
| arguments |
| ListLiteral |
| constKeyword: const @67 |
| leftBracket: [ @73 |
| rightBracket: ] @74 |
| staticType: List<String> |
| rightParenthesis: ) @75 |
| element: <testLibrary>::@class::A::@constructor::new |
| redirectedConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_initializers_thisInvocation_named() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C() : this.named(1, 'bbb'); |
| const C.named(int a, String b); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| #F3 const named @56 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 54 |
| periodOffset: 55 |
| formalParameters |
| #F4 a @66 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::a |
| #F5 b @76 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @24 |
| period: . @28 |
| constructorName: SimpleIdentifier |
| token: named @29 |
| element: <testLibrary>::@class::C::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @34 |
| arguments |
| IntegerLiteral |
| literal: 1 @35 |
| staticType: int |
| SimpleStringLiteral |
| literal: 'bbb' @38 |
| rightParenthesis: ) @43 |
| element: <testLibrary>::@class::C::@constructor::named |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::named |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F4 |
| type: int |
| requiredPositional b |
| firstFragment: #F5 |
| type: String |
| '''); |
| } |
| |
| test_class_constructor_initializers_thisInvocation_namedExpression() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C() : this.named(1, b: 2); |
| const C.named(a, {int b}); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| #F3 const named @55 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 53 |
| periodOffset: 54 |
| formalParameters |
| #F4 a @61 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::a |
| #F5 b @69 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @24 |
| period: . @28 |
| constructorName: SimpleIdentifier |
| token: named @29 |
| element: <testLibrary>::@class::C::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @34 |
| arguments |
| IntegerLiteral |
| literal: 1 @35 |
| staticType: int |
| NamedExpression |
| name: Label |
| label: SimpleIdentifier |
| token: b @38 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b |
| staticType: null |
| colon: : @39 |
| expression: IntegerLiteral |
| literal: 2 @41 |
| staticType: int |
| rightParenthesis: ) @42 |
| element: <testLibrary>::@class::C::@constructor::named |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::named |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional hasImplicitType a |
| firstFragment: #F4 |
| type: dynamic |
| optionalNamed b |
| firstFragment: #F5 |
| type: int |
| '''); |
| } |
| |
| test_class_constructor_initializers_thisInvocation_unnamed() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C.named() : this(1, 'bbb'); |
| const C(int a, String b); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const named @20 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 18 |
| periodOffset: 19 |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 54 |
| formalParameters |
| #F4 a @60 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a |
| #F5 b @70 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::b |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F2 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @30 |
| argumentList: ArgumentList |
| leftParenthesis: ( @34 |
| arguments |
| IntegerLiteral |
| literal: 1 @35 |
| staticType: int |
| SimpleStringLiteral |
| literal: 'bbb' @38 |
| rightParenthesis: ) @43 |
| element: <testLibrary>::@class::C::@constructor::new |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::new |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F4 |
| type: int |
| requiredPositional b |
| firstFragment: #F5 |
| type: String |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_explicitType_function() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(Object? a); |
| } |
| |
| class B extends A { |
| B(int super.a<T extends num>(T d)?); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @22 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @35 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 51 |
| formalParameters |
| #F6 super.a @63 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: Object? |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final a |
| firstFragment: #F6 |
| type: int Function<T extends num>(T)? |
| typeParameters |
| #E0 T |
| firstFragment: #F7 |
| bound: num |
| formalParameters |
| requiredPositional d |
| firstFragment: #F8 |
| type: T |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_explicitType_interface() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(num a); |
| } |
| |
| class B extends A { |
| B(int super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @31 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 47 |
| formalParameters |
| #F6 super.a @59 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: num |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final a |
| firstFragment: #F6 |
| type: int |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_explicitType_interface_nullable() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(num? a); |
| } |
| |
| class B extends A { |
| B(int? super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @19 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @32 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 48 |
| formalParameters |
| #F6 super.a @61 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: num? |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final a |
| firstFragment: #F6 |
| type: int? |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_invalid_topFunction() async { |
| var library = await buildLibrary(''' |
| void f(super.a) {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| functions |
| #F1 f @5 |
| element: <testLibrary>::@function::f |
| formalParameters |
| #F2 super.a @13 |
| element: <testLibrary>::@function::f::@formalParameter::a |
| functions |
| f |
| reference: <testLibrary>::@function::f |
| firstFragment: #F1 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F2 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_optionalNamed() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({required int a, required double b}); |
| } |
| |
| class B extends A { |
| B({String o1, super.a, String o2, super.b}) : super(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 b @47 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b |
| #F5 class B @61 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 77 |
| formalParameters |
| #F7 o1 @87 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1 |
| #F8 super.a @97 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| #F9 o2 @107 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2 |
| #F10 super.b @117 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredNamed a |
| firstFragment: #F3 |
| type: int |
| requiredNamed b |
| firstFragment: #F4 |
| type: double |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| formalParameters |
| optionalNamed o1 |
| firstFragment: #F7 |
| type: String |
| optionalNamed final hasImplicitType a |
| firstFragment: #F8 |
| type: int |
| optionalNamed o2 |
| firstFragment: #F9 |
| type: String |
| optionalNamed final hasImplicitType b |
| firstFragment: #F10 |
| type: double |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_optionalNamed_defaultValue() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({int a = 0}); |
| } |
| |
| class B extends A { |
| B({super.a}); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @19 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @23 |
| staticType: int |
| #F4 class B @37 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 53 |
| formalParameters |
| #F6 super.a @62 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| optionalNamed a |
| firstFragment: #F3 |
| type: int |
| constantInitializer |
| fragment: #F3 |
| expression: expression_0 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| optionalNamed final hasImplicitType a |
| firstFragment: #F6 |
| type: int |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_optionalNamed_unresolved() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({required int a}); |
| } |
| |
| class B extends A { |
| B({super.b}); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @42 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 58 |
| formalParameters |
| #F6 super.b @67 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredNamed a |
| firstFragment: #F3 |
| type: int |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| optionalNamed final hasImplicitType b |
| firstFragment: #F6 |
| type: dynamic |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_optionalNamed_unresolved2() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(int a); |
| } |
| |
| class B extends A { |
| B({super.a}); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @31 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 47 |
| formalParameters |
| #F6 super.a @56 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| optionalNamed final hasImplicitType a |
| firstFragment: #F6 |
| type: dynamic |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_optionalPositional() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(int a, double b); |
| } |
| |
| class B extends A { |
| B([String o1, super.a, String o2, super.b]) : super(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 b @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b |
| #F5 class B @41 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 57 |
| formalParameters |
| #F7 o1 @67 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1 |
| #F8 super.a @77 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| #F9 o2 @87 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2 |
| #F10 super.b @97 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| requiredPositional b |
| firstFragment: #F4 |
| type: double |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| formalParameters |
| optionalPositional o1 |
| firstFragment: #F7 |
| type: String |
| optionalPositional final hasImplicitType a |
| firstFragment: #F8 |
| type: int |
| optionalPositional o2 |
| firstFragment: #F9 |
| type: String |
| optionalPositional final hasImplicitType b |
| firstFragment: #F10 |
| type: double |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredNamed() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({required int a, required double b}); |
| } |
| |
| class B extends A { |
| B({ |
| required String o1, |
| required super.a, |
| required String o2, |
| required super.b, |
| }) : super(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 b @47 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b |
| #F5 class B @61 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 77 |
| formalParameters |
| #F7 o1 @101 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1 |
| #F8 super.a @124 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| #F9 o2 @147 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2 |
| #F10 super.b @170 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredNamed a |
| firstFragment: #F3 |
| type: int |
| requiredNamed b |
| firstFragment: #F4 |
| type: double |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| formalParameters |
| requiredNamed o1 |
| firstFragment: #F7 |
| type: String |
| requiredNamed final hasImplicitType a |
| firstFragment: #F8 |
| type: int |
| requiredNamed o2 |
| firstFragment: #F9 |
| type: String |
| requiredNamed final hasImplicitType b |
| firstFragment: #F10 |
| type: double |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredNamed_defaultValue() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({int a = 0}); |
| } |
| |
| class B extends A { |
| B({required super.a}); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @19 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @23 |
| staticType: int |
| #F4 class B @37 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 53 |
| formalParameters |
| #F6 super.a @71 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| optionalNamed a |
| firstFragment: #F3 |
| type: int |
| constantInitializer |
| fragment: #F3 |
| expression: expression_0 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredNamed final hasImplicitType a |
| firstFragment: #F6 |
| type: int |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredPositional() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(int a, double b); |
| } |
| |
| class B extends A { |
| B(String o1, super.a, String o2, super.b) : super(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 b @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b |
| #F5 class B @41 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 57 |
| formalParameters |
| #F7 o1 @66 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o1 |
| #F8 super.a @76 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| #F9 o2 @86 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::o2 |
| #F10 super.b @96 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::b |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| requiredPositional b |
| firstFragment: #F4 |
| type: double |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional o1 |
| firstFragment: #F7 |
| type: String |
| requiredPositional final hasImplicitType a |
| firstFragment: #F8 |
| type: int |
| requiredPositional o2 |
| firstFragment: #F9 |
| type: String |
| requiredPositional final hasImplicitType b |
| firstFragment: #F10 |
| type: double |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredPositional_inferenceOrder() async { |
| // It is important that `B` is declared after `C`, so that we check that |
| // inference happens in order - first `B`, then `C`. |
| var library = await buildLibrary(''' |
| abstract class A { |
| A(int a); |
| } |
| |
| class C extends B { |
| C(super.a); |
| } |
| |
| class B extends A { |
| B(super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @15 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 21 |
| formalParameters |
| #F3 a @27 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class C @40 |
| element: <testLibrary>::@class::C |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 56 |
| formalParameters |
| #F6 super.a @64 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a |
| #F7 class B @77 |
| element: <testLibrary>::@class::B |
| constructors |
| #F8 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 93 |
| formalParameters |
| #F9 super.a @101 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F4 |
| supertype: B |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F6 |
| type: int |
| superConstructor: <testLibrary>::@class::B::@constructor::new |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F7 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F9 |
| type: int |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredPositional_inferenceOrder_generic() async { |
| // It is important that `C` is declared before `B`, so that we check that |
| // inference happens in order - first `B`, then `C`. |
| var library = await buildLibrary(''' |
| class A { |
| A(int a); |
| } |
| |
| class C extends B<String> { |
| C(super.a); |
| } |
| |
| class B<T> extends A { |
| B(super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class C @31 |
| element: <testLibrary>::@class::C |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 55 |
| formalParameters |
| #F6 super.a @63 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::a |
| #F7 class B @76 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F8 T @78 |
| element: #E0 T |
| constructors |
| #F9 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 95 |
| formalParameters |
| #F10 super.a @103 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F4 |
| supertype: B<String> |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F6 |
| type: int |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::B::@constructor::new |
| substitution: {T: String} |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F7 |
| typeParameters |
| #E0 T |
| firstFragment: #F8 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F10 |
| type: int |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredPositional_unresolved() async { |
| var library = await buildLibrary(''' |
| class A {} |
| |
| class B extends A { |
| B(super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @18 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 34 |
| formalParameters |
| #F5 super.a @42 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F5 |
| type: dynamic |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_parameters_super_requiredPositional_unresolved2() async { |
| var library = await buildLibrary(''' |
| class A { |
| A({required int a}) |
| } |
| |
| class B extends A { |
| B(super.a); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 a @28 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a |
| #F4 class B @41 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 57 |
| formalParameters |
| #F6 super.a @65 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::a |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredNamed a |
| firstFragment: #F3 |
| type: int |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional final hasImplicitType a |
| firstFragment: #F6 |
| type: dynamic |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_params() async { |
| var library = await buildLibrary('class C { C(x, int y); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 10 |
| formalParameters |
| #F3 x @12 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x |
| #F4 y @19 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::y |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional hasImplicitType x |
| firstFragment: #F3 |
| type: dynamic |
| requiredPositional y |
| firstFragment: #F4 |
| type: int |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named() async { |
| var library = await buildLibrary(''' |
| class C { |
| factory C() = D.named; |
| C._(); |
| } |
| class D extends C { |
| D.named() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 20 |
| #F3 _ @39 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 37 |
| periodOffset: 38 |
| #F4 class D @52 |
| element: <testLibrary>::@class::D |
| constructors |
| #F5 named @70 |
| element: <testLibrary>::@class::D::@constructor::named |
| typeName: D |
| typeNameOffset: 68 |
| periodOffset: 69 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: <testLibrary>::@class::D::@constructor::named |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| supertype: C |
| constructors |
| named |
| reference: <testLibrary>::@class::D::@constructor::named |
| firstFragment: #F5 |
| superConstructor: <testLibrary>::@class::C::@constructor::_ |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_generic() async { |
| var library = await buildLibrary(''' |
| class C<T, U> { |
| factory C() = D<U, T>.named; |
| C._(); |
| } |
| class D<T, U> extends C<U, T> { |
| D.named() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 26 |
| #F5 _ @51 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 49 |
| periodOffset: 50 |
| #F6 class D @64 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F7 T @66 |
| element: #E2 T |
| #F8 U @69 |
| element: #E3 U |
| constructors |
| #F9 named @94 |
| element: <testLibrary>::@class::D::@constructor::named |
| typeName: D |
| typeNameOffset: 92 |
| periodOffset: 93 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::D::@constructor::named |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F6 |
| typeParameters |
| #E2 T |
| firstFragment: #F7 |
| #E3 U |
| firstFragment: #F8 |
| supertype: C<U, T> |
| constructors |
| named |
| reference: <testLibrary>::@class::D::@constructor::named |
| firstFragment: #F9 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::C::@constructor::_ |
| substitution: {T: U, U: T} |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_generic_viaTypeAlias() async { |
| var library = await buildLibrary(''' |
| typedef A<T, U> = C<T, U>; |
| class B<T, U> { |
| factory B() = A<U, T>.named; |
| B._(); |
| } |
| class C<T, U> extends A<U, T> { |
| C.named() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @33 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F2 T @35 |
| element: #E0 T |
| #F3 U @38 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 53 |
| #F5 _ @78 |
| element: <testLibrary>::@class::B::@constructor::_ |
| typeName: B |
| typeNameOffset: 76 |
| periodOffset: 77 |
| #F6 class C @91 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F7 T @93 |
| element: #E2 T |
| #F8 U @96 |
| element: #E3 U |
| constructors |
| #F9 named @121 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 119 |
| periodOffset: 120 |
| typeAliases |
| #F10 A @8 |
| element: <testLibrary>::@typeAlias::A |
| typeParameters |
| #F11 T @10 |
| element: #E4 T |
| #F12 U @13 |
| element: #E5 U |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::C::@constructor::named |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::B::@constructor::_ |
| firstFragment: #F5 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F6 |
| typeParameters |
| #E2 T |
| firstFragment: #F7 |
| #E3 U |
| firstFragment: #F8 |
| supertype: C<U, T> |
| alias: <testLibrary>::@typeAlias::A |
| typeArguments |
| U |
| T |
| constructors |
| named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F9 |
| typeAliases |
| A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F10 |
| typeParameters |
| #E4 T |
| firstFragment: #F11 |
| #E5 U |
| firstFragment: #F12 |
| aliasedType: C<T, U> |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_imported() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D extends C { |
| D.named() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart'; |
| class C { |
| factory C() = D.named; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 39 |
| #F3 _ @58 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 56 |
| periodOffset: 57 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::D::@constructor::named |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_imported_generic() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D<T, U> extends C<U, T> { |
| D.named() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart'; |
| class C<T, U> { |
| factory C() = D<U, T>.named; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @27 |
| element: #E0 T |
| #F3 U @30 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 45 |
| #F5 _ @70 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 68 |
| periodOffset: 69 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: package:test/foo.dart::@class::D::@constructor::named |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_prefixed() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D extends C { |
| D.named() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| class C { |
| factory C() = foo.D.named; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| prefixes |
| <testLibraryFragment>::@prefix2::foo |
| fragments: @21 |
| classes |
| #F1 class C @32 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 46 |
| #F3 _ @69 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 67 |
| periodOffset: 68 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::D::@constructor::named |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_prefixed_generic() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D<T, U> extends C<U, T> { |
| D.named() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| class C<T, U> { |
| factory C() = foo.D<U, T>.named; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| prefixes |
| <testLibraryFragment>::@prefix2::foo |
| fragments: @21 |
| classes |
| #F1 class C @32 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @34 |
| element: #E0 T |
| #F3 U @37 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 52 |
| #F5 _ @81 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 79 |
| periodOffset: 80 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: package:test/foo.dart::@class::D::@constructor::named |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_unresolved_class() async { |
| var library = await buildLibrary(''' |
| class C<E> { |
| factory C() = D.named<E>; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 E @8 |
| element: #E0 E |
| constructors |
| #F3 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 23 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 E |
| firstFragment: #F2 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_named_unresolved_constructor() async { |
| var library = await buildLibrary(''' |
| class D {} |
| class C<E> { |
| factory C() = D.named<E>; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class D @6 |
| element: <testLibrary>::@class::D |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F3 class C @17 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F4 E @19 |
| element: #E0 E |
| constructors |
| #F5 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 34 |
| classes |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F2 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F3 |
| typeParameters |
| #E0 E |
| firstFragment: #F4 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed() async { |
| var library = await buildLibrary(''' |
| class C { |
| factory C() = D; |
| C._(); |
| } |
| class D extends C { |
| D() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 20 |
| #F3 _ @33 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 31 |
| periodOffset: 32 |
| #F4 class D @46 |
| element: <testLibrary>::@class::D |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| typeNameOffset: 62 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: <testLibrary>::@class::D::@constructor::new |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| supertype: C |
| constructors |
| new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F5 |
| superConstructor: <testLibrary>::@class::C::@constructor::_ |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_generic() async { |
| var library = await buildLibrary(''' |
| class C<T, U> { |
| factory C() = D<U, T>; |
| C._(); |
| } |
| class D<T, U> extends C<U, T> { |
| D() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 26 |
| #F5 _ @45 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 43 |
| periodOffset: 44 |
| #F6 class D @58 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F7 T @60 |
| element: #E2 T |
| #F8 U @63 |
| element: #E3 U |
| constructors |
| #F9 new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| typeNameOffset: 86 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::D::@constructor::new |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F6 |
| typeParameters |
| #E2 T |
| firstFragment: #F7 |
| #E3 U |
| firstFragment: #F8 |
| supertype: C<U, T> |
| constructors |
| new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F9 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::C::@constructor::_ |
| substitution: {T: U, U: T} |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_generic_viaTypeAlias() async { |
| var library = await buildLibrary(''' |
| typedef A<T, U> = C<T, U>; |
| class B<T, U> { |
| factory B() = A<U, T>; |
| B_(); |
| } |
| class C<T, U> extends B<U, T> { |
| C() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @33 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F2 T @35 |
| element: #E0 T |
| #F3 U @38 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 53 |
| methods |
| #F5 B_ @70 |
| element: <testLibrary>::@class::B::@method::B_ |
| #F6 class C @84 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F7 T @86 |
| element: #E2 T |
| #F8 U @89 |
| element: #E3 U |
| constructors |
| #F9 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 112 |
| typeAliases |
| #F10 A @8 |
| element: <testLibrary>::@typeAlias::A |
| typeParameters |
| #F11 T @10 |
| element: #E4 T |
| #F12 U @13 |
| element: #E5 U |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::C::@constructor::new |
| substitution: {T: U, U: T} |
| methods |
| abstract B_ |
| reference: <testLibrary>::@class::B::@method::B_ |
| firstFragment: #F5 |
| returnType: dynamic |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F6 |
| typeParameters |
| #E2 T |
| firstFragment: #F7 |
| #E3 U |
| firstFragment: #F8 |
| supertype: B<U, T> |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F9 |
| typeAliases |
| A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F10 |
| typeParameters |
| #E4 T |
| firstFragment: #F11 |
| #E5 U |
| firstFragment: #F12 |
| aliasedType: C<T, U> |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_imported() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D extends C { |
| D() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart'; |
| class C { |
| factory C() = D; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 39 |
| #F3 _ @52 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 50 |
| periodOffset: 51 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::D::@constructor::new |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_imported_generic() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D<T, U> extends C<U, T> { |
| D() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart'; |
| class C<T, U> { |
| factory C() = D<U, T>; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @27 |
| element: #E0 T |
| #F3 U @30 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 45 |
| #F5 _ @64 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 62 |
| periodOffset: 63 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: package:test/foo.dart::@class::D::@constructor::new |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_imported_viaTypeAlias() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| typedef A = B; |
| class B extends C { |
| B() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart'; |
| class C { |
| factory C() = A; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 39 |
| #F3 _ @52 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 50 |
| periodOffset: 51 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::B::@constructor::new |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_prefixed() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D extends C { |
| D() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| class C { |
| factory C() = foo.D; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| prefixes |
| <testLibraryFragment>::@prefix2::foo |
| fragments: @21 |
| classes |
| #F1 class C @32 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 46 |
| #F3 _ @63 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 61 |
| periodOffset: 62 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::D::@constructor::new |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_prefixed_generic() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| class D<T, U> extends C<U, T> { |
| D() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| class C<T, U> { |
| factory C() = foo.D<U, T>; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| prefixes |
| <testLibraryFragment>::@prefix2::foo |
| fragments: @21 |
| classes |
| #F1 class C @32 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @34 |
| element: #E0 T |
| #F3 U @37 |
| element: #E1 U |
| constructors |
| #F4 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 52 |
| #F5 _ @75 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 73 |
| periodOffset: 74 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| redirectedConstructor: ConstructorMember |
| baseElement: package:test/foo.dart::@class::D::@constructor::new |
| substitution: {T: U, U: T} |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_prefixed_viaTypeAlias() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| import 'test.dart'; |
| typedef A = B; |
| class B extends C { |
| B() : super._(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| class C { |
| factory C() = foo.A; |
| C._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| prefixes |
| <testLibraryFragment>::@prefix2::foo |
| fragments: @21 |
| classes |
| #F1 class C @32 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 46 |
| #F3 _ @63 |
| element: <testLibrary>::@class::C::@constructor::_ |
| typeName: C |
| typeNameOffset: 61 |
| periodOffset: 62 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: package:test/foo.dart::@class::B::@constructor::new |
| _ |
| reference: <testLibrary>::@class::C::@constructor::_ |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_unresolved() async { |
| var library = await buildLibrary(''' |
| class C<E> { |
| factory C() = D<E>; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 E @8 |
| element: #E0 E |
| constructors |
| #F3 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 23 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 E |
| firstFragment: #F2 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_constructor_redirected_factory_unnamed_viaTypeAlias() async { |
| var library = await buildLibrary(''' |
| typedef A = C; |
| class B { |
| factory B() = A; |
| B._(); |
| } |
| class C extends B { |
| C() : super._(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @21 |
| element: <testLibrary>::@class::B |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 35 |
| #F3 _ @48 |
| element: <testLibrary>::@class::B::@constructor::_ |
| typeName: B |
| typeNameOffset: 46 |
| periodOffset: 47 |
| #F4 class C @61 |
| element: <testLibrary>::@class::C |
| constructors |
| #F5 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 77 |
| typeAliases |
| #F6 A @8 |
| element: <testLibrary>::@typeAlias::A |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::new |
| _ |
| reference: <testLibrary>::@class::B::@constructor::_ |
| firstFragment: #F3 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F4 |
| supertype: B |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| superConstructor: <testLibrary>::@class::B::@constructor::_ |
| typeAliases |
| A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F6 |
| aliasedType: C |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_named() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C.named(); |
| const C() : this.named(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const named @20 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 18 |
| periodOffset: 19 |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 37 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F2 |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @43 |
| period: . @47 |
| constructorName: SimpleIdentifier |
| token: named @48 |
| element: <testLibrary>::@class::C::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @53 |
| rightParenthesis: ) @54 |
| element: <testLibrary>::@class::C::@constructor::named |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::named |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_named_generic() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| const C.named(); |
| const C() : this.named(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 const named @23 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 21 |
| periodOffset: 22 |
| #F4 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 40 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @46 |
| period: . @50 |
| constructorName: SimpleIdentifier |
| token: named @51 |
| element: <testLibrary>::@class::C::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @56 |
| rightParenthesis: ) @57 |
| element: <testLibrary>::@class::C::@constructor::named |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::named |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_named_notConst() async { |
| var library = await buildLibrary(''' |
| class C { |
| C.named(); |
| C() : this.named(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 named @14 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 12 |
| periodOffset: 13 |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 25 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F2 |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::named |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_unnamed() async { |
| var library = await buildLibrary(''' |
| class C { |
| const C(); |
| const C.named() : this(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 18 |
| #F3 const named @33 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 31 |
| periodOffset: 32 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @43 |
| argumentList: ArgumentList |
| leftParenthesis: ( @47 |
| rightParenthesis: ) @48 |
| element: <testLibrary>::@class::C::@constructor::new |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_unnamed_generic() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| const C(); |
| const C.named() : this(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 21 |
| #F4 const named @36 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 34 |
| periodOffset: 35 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F4 |
| constantInitializers |
| RedirectingConstructorInvocation |
| thisKeyword: this @46 |
| argumentList: ArgumentList |
| leftParenthesis: ( @50 |
| rightParenthesis: ) @51 |
| element: <testLibrary>::@class::C::@constructor::new |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_redirected_thisInvocation_unnamed_notConst() async { |
| var library = await buildLibrary(''' |
| class C { |
| C(); |
| C.named() : this(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 12 |
| #F3 named @21 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 19 |
| periodOffset: 20 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| redirectedConstructor: <testLibrary>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_redirectedConstructor_generic01() async { |
| // Note, this code has compile-time errors. |
| // `A` returned by the redirected constructor is not `B<U>`. |
| // But we still have some element model. |
| var library = await buildLibrary(r''' |
| class A implements B<int> {} |
| |
| class B<U> implements C<U> { |
| factory B() = A; |
| } |
| |
| class C<V> { |
| factory C() = B<V>; |
| } |
| '''); |
| |
| configuration |
| ..forClassConstructors(classNames: {'C'}) |
| ..elementPrinterConfiguration.withRedirectedConstructors = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @87 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 104 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::B::@constructor::new |
| substitution: {U: V} |
| redirectedConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_redirectedConstructor_generic11() async { |
| var library = await buildLibrary(r''' |
| class A<T> implements B<T> {} |
| |
| class B<U> implements C<U> { |
| factory B() = A<U>; |
| } |
| |
| class C<V> { |
| factory C() = B<V>; |
| } |
| '''); |
| |
| configuration |
| ..forClassConstructors(classNames: {'C'}) |
| ..elementPrinterConfiguration.withRedirectedConstructors = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @91 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 factory new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 108 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| factory new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::B::@constructor::new |
| substitution: {U: V} |
| redirectedConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: V} |
| redirectedConstructor: <null> |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_generic01() async { |
| var library = await buildLibrary(r''' |
| class A {} |
| class B<U> extends A {} |
| class C extends B<int> {} |
| '''); |
| |
| configuration |
| ..forClassConstructors(classNames: {'C'}) |
| ..elementPrinterConfiguration.withSuperConstructors = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @41 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: B<int> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::B::@constructor::new |
| substitution: {U: int} |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_generic11() async { |
| var library = await buildLibrary(r''' |
| class A<T> {} |
| class B<U> extends A<String> {} |
| class C extends B<int> {} |
| '''); |
| |
| configuration |
| ..forClassConstructors(classNames: {'C'}) |
| ..elementPrinterConfiguration.withSuperConstructors = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @52 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: B<int> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::B::@constructor::new |
| substitution: {U: int} |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: String} |
| superConstructor: dart:core::@class::Object::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_generic_named() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| A.named(T a); |
| } |
| class B extends A<int> { |
| B() : super.named(0); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 named @17 |
| element: <testLibrary>::@class::A::@constructor::named |
| typeName: A |
| typeNameOffset: 15 |
| periodOffset: 16 |
| formalParameters |
| #F4 a @25 |
| element: <testLibrary>::@class::A::@constructor::named::@formalParameter::a |
| #F5 class B @37 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 58 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| named |
| reference: <testLibrary>::@class::A::@constructor::named |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F4 |
| type: T |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A<int> |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::named |
| substitution: {T: int} |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_notGeneric_named() async { |
| var library = await buildLibrary(''' |
| class A { |
| A.named(); |
| } |
| class B extends A { |
| B() : super.named(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 named @14 |
| element: <testLibrary>::@class::A::@constructor::named |
| typeName: A |
| typeNameOffset: 12 |
| periodOffset: 13 |
| #F3 class B @31 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 47 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| named |
| reference: <testLibrary>::@class::A::@constructor::named |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::named |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_notGeneric_unnamed_explicit() async { |
| var library = await buildLibrary(''' |
| class A {} |
| class B extends A { |
| B() : super(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @17 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 33 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_notGeneric_unnamed_implicit() async { |
| var library = await buildLibrary(''' |
| class A {} |
| class B extends A { |
| B(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @17 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 33 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_superConstructor_notGeneric_unnamed_implicit2() async { |
| var library = await buildLibrary(''' |
| class A {} |
| class B extends A {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @17 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_constructor_unnamed_implicit() async { |
| var library = await buildLibrary('class C {}'); |
| configuration.withDisplayName = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructor_withCycles_const() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x; |
| const C() : x = const D(); |
| } |
| class D { |
| final x; |
| const D() : x = const C(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 29 |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| #F5 class D @58 |
| element: <testLibrary>::@class::D |
| fields |
| #F6 x @70 |
| element: <testLibrary>::@class::D::@field::x |
| constructors |
| #F7 const new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| typeNameOffset: 81 |
| getters |
| #F8 synthetic x |
| element: <testLibrary>::@class::D::@getter::x |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @35 |
| element: <testLibrary>::@class::C::@field::x |
| staticType: null |
| equals: = @37 |
| expression: InstanceCreationExpression |
| keyword: const @39 |
| constructorName: ConstructorName |
| type: NamedType |
| name: D @45 |
| element2: <testLibrary>::@class::D |
| type: D |
| element: <testLibrary>::@class::D::@constructor::new |
| argumentList: ArgumentList |
| leftParenthesis: ( @46 |
| rightParenthesis: ) @47 |
| staticType: D |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F5 |
| fields |
| final x |
| reference: <testLibrary>::@class::D::@field::x |
| firstFragment: #F6 |
| type: dynamic |
| getter: <testLibrary>::@class::D::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F7 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: x @87 |
| element: <testLibrary>::@class::D::@field::x |
| staticType: null |
| equals: = @89 |
| expression: InstanceCreationExpression |
| keyword: const @91 |
| constructorName: ConstructorName |
| type: NamedType |
| name: C @97 |
| element2: <testLibrary>::@class::C |
| type: C |
| element: <testLibrary>::@class::C::@constructor::new |
| argumentList: ArgumentList |
| leftParenthesis: ( @98 |
| rightParenthesis: ) @99 |
| staticType: C |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::D::@getter::x |
| firstFragment: #F8 |
| returnType: dynamic |
| variable: <testLibrary>::@class::D::@field::x |
| '''); |
| } |
| |
| test_class_constructor_withCycles_nonConst() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x; |
| C() : x = new D(); |
| } |
| class D { |
| final x; |
| D() : x = new C(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 23 |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| #F5 class D @50 |
| element: <testLibrary>::@class::D |
| fields |
| #F6 x @62 |
| element: <testLibrary>::@class::D::@field::x |
| constructors |
| #F7 new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| typeNameOffset: 67 |
| getters |
| #F8 synthetic x |
| element: <testLibrary>::@class::D::@getter::x |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F5 |
| fields |
| final x |
| reference: <testLibrary>::@class::D::@field::x |
| firstFragment: #F6 |
| type: dynamic |
| getter: <testLibrary>::@class::D::@getter::x |
| constructors |
| new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F7 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::D::@getter::x |
| firstFragment: #F8 |
| returnType: dynamic |
| variable: <testLibrary>::@class::D::@field::x |
| '''); |
| } |
| |
| test_class_constructors_named() async { |
| var library = await buildLibrary(''' |
| class C { |
| C.foo(); |
| } |
| '''); |
| configuration.withDisplayName = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 foo @14 |
| element: <testLibrary>::@class::C::@constructor::foo |
| typeName: C |
| typeNameOffset: 12 |
| periodOffset: 13 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| foo |
| reference: <testLibrary>::@class::C::@constructor::foo |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructors_unnamed() async { |
| var library = await buildLibrary(''' |
| class C { |
| C(); |
| } |
| '''); |
| configuration.withDisplayName = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 12 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_constructors_unnamed_new() async { |
| var library = await buildLibrary(''' |
| class C { |
| C.new(); |
| } |
| '''); |
| configuration.withDisplayName = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 new @14 |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 12 |
| periodOffset: 13 |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_documented() async { |
| var library = await buildLibrary(''' |
| /** |
| * Docs |
| */ |
| class C {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @22 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_documented_mix() async { |
| var library = await buildLibrary(''' |
| /** |
| * aaa |
| */ |
| /** |
| * bbb |
| */ |
| class A {} |
| |
| /** |
| * aaa |
| */ |
| /// bbb |
| /// ccc |
| class B {} |
| |
| /// aaa |
| /// bbb |
| /** |
| * ccc |
| */ |
| class C {} |
| |
| /// aaa |
| /// bbb |
| /** |
| * ccc |
| */ |
| /// ddd |
| class D {} |
| |
| /** |
| * aaa |
| */ |
| // bbb |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @36 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @79 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| #F5 class C @122 |
| element: <testLibrary>::@class::C |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F7 class D @173 |
| element: <testLibrary>::@class::D |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F9 class E @207 |
| element: <testLibrary>::@class::E |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| documentationComment: /**\n * bbb\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| documentationComment: /// bbb\n/// ccc |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F5 |
| documentationComment: /**\n * ccc\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F6 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F7 |
| documentationComment: /// ddd |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F8 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F9 |
| documentationComment: /**\n * aaa\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F10 |
| '''); |
| } |
| |
| test_class_documented_tripleSlash() async { |
| var library = await buildLibrary(''' |
| /// first |
| /// second |
| /// third |
| class C {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @37 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /// first\n/// second\n/// third |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_documented_with_references() async { |
| var library = await buildLibrary(''' |
| /** |
| * Docs referring to [D] and [E] |
| */ |
| class C {} |
| |
| class D {} |
| class E {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @47 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @59 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @70 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs referring to [D] and [E]\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_documented_with_windows_line_endings() async { |
| var library = await buildLibrary('/**\r\n * Docs\r\n */\r\nclass C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @25 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_documented_withLeadingNotDocumentation() async { |
| var library = await buildLibrary(''' |
| // Extra comment so doc comment offset != 0 |
| /** |
| * Docs |
| */ |
| class C {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @66 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs\n */ |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_documented_withMetadata() async { |
| var library = await buildLibrary(''' |
| /// Comment 1 |
| /// Comment 2 |
| @Annotation() |
| class BeforeMeta {} |
| |
| /// Comment 1 |
| /// Comment 2 |
| @Annotation.named() |
| class BeforeMetaNamed {} |
| |
| @Annotation() |
| /// Comment 1 |
| /// Comment 2 |
| class AfterMeta {} |
| |
| /// Comment 1 |
| @Annotation() |
| /// Comment 2 |
| class AroundMeta {} |
| |
| /// Doc comment. |
| @Annotation() |
| // Not doc comment. |
| class DocBeforeMetaNotDocAfter {} |
| |
| class Annotation { |
| const Annotation(); |
| const Annotation.named(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class BeforeMeta @48 |
| element: <testLibrary>::@class::BeforeMeta |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::BeforeMeta::@constructor::new |
| typeName: BeforeMeta |
| #F3 class BeforeMetaNamed @117 |
| element: <testLibrary>::@class::BeforeMetaNamed |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::BeforeMetaNamed::@constructor::new |
| typeName: BeforeMetaNamed |
| #F5 class AfterMeta @185 |
| element: <testLibrary>::@class::AfterMeta |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::AfterMeta::@constructor::new |
| typeName: AfterMeta |
| #F7 class AroundMeta @247 |
| element: <testLibrary>::@class::AroundMeta |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::AroundMeta::@constructor::new |
| typeName: AroundMeta |
| #F9 class DocBeforeMetaNotDocAfter @319 |
| element: <testLibrary>::@class::DocBeforeMetaNotDocAfter |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::DocBeforeMetaNotDocAfter::@constructor::new |
| typeName: DocBeforeMetaNotDocAfter |
| #F11 class Annotation @354 |
| element: <testLibrary>::@class::Annotation |
| constructors |
| #F12 const new |
| element: <testLibrary>::@class::Annotation::@constructor::new |
| typeName: Annotation |
| typeNameOffset: 375 |
| #F13 const named @408 |
| element: <testLibrary>::@class::Annotation::@constructor::named |
| typeName: Annotation |
| typeNameOffset: 397 |
| periodOffset: 407 |
| classes |
| class BeforeMeta |
| reference: <testLibrary>::@class::BeforeMeta |
| firstFragment: #F1 |
| documentationComment: /// Comment 1\n/// Comment 2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::BeforeMeta::@constructor::new |
| firstFragment: #F2 |
| class BeforeMetaNamed |
| reference: <testLibrary>::@class::BeforeMetaNamed |
| firstFragment: #F3 |
| documentationComment: /// Comment 1\n/// Comment 2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::BeforeMetaNamed::@constructor::new |
| firstFragment: #F4 |
| class AfterMeta |
| reference: <testLibrary>::@class::AfterMeta |
| firstFragment: #F5 |
| documentationComment: /// Comment 1\n/// Comment 2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::AfterMeta::@constructor::new |
| firstFragment: #F6 |
| class AroundMeta |
| reference: <testLibrary>::@class::AroundMeta |
| firstFragment: #F7 |
| documentationComment: /// Comment 2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::AroundMeta::@constructor::new |
| firstFragment: #F8 |
| class DocBeforeMetaNotDocAfter |
| reference: <testLibrary>::@class::DocBeforeMetaNotDocAfter |
| firstFragment: #F9 |
| documentationComment: /// Doc comment. |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::DocBeforeMetaNotDocAfter::@constructor::new |
| firstFragment: #F10 |
| class Annotation |
| reference: <testLibrary>::@class::Annotation |
| firstFragment: #F11 |
| constructors |
| const new |
| reference: <testLibrary>::@class::Annotation::@constructor::new |
| firstFragment: #F12 |
| const named |
| reference: <testLibrary>::@class::Annotation::@constructor::named |
| firstFragment: #F13 |
| '''); |
| } |
| |
| test_class_field_abstract() async { |
| var library = await buildLibrary(''' |
| abstract class C { |
| abstract int i; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 i @34 |
| element: <testLibrary>::@class::C::@field::i |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| setters |
| #F5 synthetic i |
| element: <testLibrary>::@class::C::@setter::i |
| formalParameters |
| #F6 _i |
| element: <testLibrary>::@class::C::@setter::i::@formalParameter::_i |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| abstract i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::i |
| setter: <testLibrary>::@class::C::@setter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic abstract i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| setters |
| synthetic abstract i |
| reference: <testLibrary>::@class::C::@setter::i |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _i |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_const() async { |
| var library = await buildLibrary('class C { static const int i = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer i @27 |
| element: <testLibrary>::@class::C::@field::i |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @31 |
| staticType: int |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static const hasInitializer i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| constantInitializer |
| fragment: #F2 |
| expression: expression_0 |
| getter: <testLibrary>::@class::C::@getter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| '''); |
| } |
| |
| test_class_field_const_late() async { |
| var library = await buildLibrary( |
| 'class C { static late const int i = 0; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer i @32 |
| element: <testLibrary>::@class::C::@field::i |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @36 |
| staticType: int |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static late const hasInitializer i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| constantInitializer |
| fragment: #F2 |
| expression: expression_0 |
| getter: <testLibrary>::@class::C::@getter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| '''); |
| } |
| |
| test_class_field_covariant() async { |
| var library = await buildLibrary(''' |
| class C { |
| covariant int x; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @26 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| covariant x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional covariant _x |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_documented() async { |
| var library = await buildLibrary(''' |
| class C { |
| /** |
| * Docs |
| */ |
| var x; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @38 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F6 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_duplicate_getter() async { |
| var library = await buildLibrary(''' |
| class C { |
| int foo = 0; |
| int get foo => 0; |
| } |
| '''); |
| configuration |
| ..withAugmentedWithoutAugmentation = true |
| ..withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer foo @16 |
| element: <testLibrary>::@class::C::@field::foo::@def::0 |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo::@def::1 |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo::@def::0 |
| returnType: int |
| #F6 foo @35 |
| element: <testLibrary>::@class::C::@getter::foo::@def::1 |
| returnType: int |
| setters |
| #F7 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F8 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer foo |
| reference: <testLibrary>::@class::C::@field::foo::@def::0 |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo::@def::0 |
| setter: <testLibrary>::@class::C::@setter::foo |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo::@def::1 |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo::@def::1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo::@def::0 |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo::@def::0 |
| foo |
| reference: <testLibrary>::@class::C::@getter::foo::@def::1 |
| firstFragment: #F6 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo::@def::1 |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F8 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_duplicate_setter() async { |
| var library = await buildLibrary(''' |
| class C { |
| int foo = 0; |
| set foo(int _) {} |
| } |
| '''); |
| configuration |
| ..withAugmentedWithoutAugmentation = true |
| ..withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer foo @16 |
| element: <testLibrary>::@class::C::@field::foo::@def::0 |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo::@def::1 |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F6 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo::@def::0 |
| formalParameters |
| #F7 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@def::0::@formalParameter::_foo |
| #F8 foo @31 |
| element: <testLibrary>::@class::C::@setter::foo::@def::1 |
| formalParameters |
| #F9 _ @39 |
| element: <testLibrary>::@class::C::@setter::foo::@def::1::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer foo |
| reference: <testLibrary>::@class::C::@field::foo::@def::0 |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo::@def::0 |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo::@def::1 |
| firstFragment: #F3 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::foo::@def::1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo::@def::0 |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo::@def::0 |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| foo |
| reference: <testLibrary>::@class::C::@setter::foo::@def::1 |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F9 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_external() async { |
| var library = await buildLibrary(''' |
| abstract class C { |
| external int i; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 i @34 |
| element: <testLibrary>::@class::C::@field::i |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| setters |
| #F5 synthetic i |
| element: <testLibrary>::@class::C::@setter::i |
| formalParameters |
| #F6 _i |
| element: <testLibrary>::@class::C::@setter::i::@formalParameter::_i |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| external i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::i |
| setter: <testLibrary>::@class::C::@setter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| setters |
| synthetic i |
| reference: <testLibrary>::@class::C::@setter::i |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _i |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_final_hasInitializer_hasConstConstructor() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x = 42; |
| const C(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @18 |
| element: <testLibrary>::@class::C::@field::x |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 42 @22 |
| staticType: int |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 34 |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| constantInitializer |
| fragment: #F2 |
| expression: expression_0 |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_final_hasInitializer_hasConstConstructor_genericFunctionType() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A(); |
| } |
| class B { |
| final f = const A<int Function(double a)>(); |
| const B(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 21 |
| #F4 class B @34 |
| element: <testLibrary>::@class::B |
| fields |
| #F5 hasInitializer f @46 |
| element: <testLibrary>::@class::B::@field::f |
| initializer: expression_0 |
| InstanceCreationExpression |
| keyword: const @50 |
| constructorName: ConstructorName |
| type: NamedType |
| name: A @56 |
| typeArguments: TypeArgumentList |
| leftBracket: < @57 |
| arguments |
| GenericFunctionType |
| returnType: NamedType |
| name: int @58 |
| element2: dart:core::@class::int |
| type: int |
| functionKeyword: Function @62 |
| parameters: FormalParameterList |
| leftParenthesis: ( @70 |
| parameter: SimpleFormalParameter |
| type: NamedType |
| name: double @71 |
| element2: dart:core::@class::double |
| type: double |
| name: a @78 |
| declaredElement: <testLibraryFragment> a@78 |
| type: double |
| rightParenthesis: ) @79 |
| declaredElement: GenericFunctionTypeElement |
| parameters |
| a |
| kind: required positional |
| type: double |
| returnType: int |
| type: int Function(double) |
| type: int Function(double) |
| rightBracket: > @80 |
| element2: <testLibrary>::@class::A |
| type: A<int Function(double)> |
| element: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: int Function(double)} |
| argumentList: ArgumentList |
| leftParenthesis: ( @81 |
| rightParenthesis: ) @82 |
| staticType: A<int Function(double)> |
| constructors |
| #F6 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 93 |
| getters |
| #F7 synthetic f |
| element: <testLibrary>::@class::B::@getter::f |
| returnType: A<int Function(double)> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| fields |
| final hasInitializer f |
| reference: <testLibrary>::@class::B::@field::f |
| firstFragment: #F5 |
| type: A<int Function(double)> |
| constantInitializer |
| fragment: #F5 |
| expression: expression_0 |
| getter: <testLibrary>::@class::B::@getter::f |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| getters |
| synthetic f |
| reference: <testLibrary>::@class::B::@getter::f |
| firstFragment: #F7 |
| returnType: A<int Function(double)> |
| variable: <testLibrary>::@class::B::@field::f |
| '''); |
| } |
| |
| test_class_field_final_hasInitializer_noConstConstructor() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x = 42; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_final_withSetter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int foo; |
| A(this.foo); |
| set foo(int newValue) {} |
| } |
| '''); |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 foo @22 |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 29 |
| formalParameters |
| #F4 this.foo @36 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::foo |
| getters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| setters |
| #F6 foo @48 |
| element: <testLibrary>::@class::A::@setter::foo |
| formalParameters |
| #F7 newValue @56 |
| element: <testLibrary>::@class::A::@setter::foo::@formalParameter::newValue |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| final foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| setter: <testLibrary>::@class::A::@setter::foo |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType foo |
| firstFragment: #F4 |
| type: int |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| setters |
| foo |
| reference: <testLibrary>::@class::A::@setter::foo |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional newValue |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_formal_param_inferred_type_implicit() async { |
| var library = await buildLibrary( |
| 'class C extends D { var v; C(this.v); }' |
| ' abstract class D { int get v; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 v @24 |
| element: <testLibrary>::@class::C::@field::v |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 27 |
| formalParameters |
| #F4 this.v @34 |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::v |
| getters |
| #F5 synthetic v |
| element: <testLibrary>::@class::C::@getter::v |
| returnType: int |
| setters |
| #F6 synthetic v |
| element: <testLibrary>::@class::C::@setter::v |
| formalParameters |
| #F7 _v |
| element: <testLibrary>::@class::C::@setter::v::@formalParameter::_v |
| #F8 class D @55 |
| element: <testLibrary>::@class::D |
| fields |
| #F9 synthetic v |
| element: <testLibrary>::@class::D::@field::v |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| getters |
| #F11 v @67 |
| element: <testLibrary>::@class::D::@getter::v |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| fields |
| v |
| reference: <testLibrary>::@class::C::@field::v |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::v |
| setter: <testLibrary>::@class::C::@setter::v |
| constructors |
| new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType v |
| firstFragment: #F4 |
| type: int |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| getters |
| synthetic v |
| reference: <testLibrary>::@class::C::@getter::v |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::v |
| setters |
| synthetic v |
| reference: <testLibrary>::@class::C::@setter::v |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| abstract class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F8 |
| fields |
| synthetic v |
| reference: <testLibrary>::@class::D::@field::v |
| firstFragment: #F9 |
| type: int |
| getter: <testLibrary>::@class::D::@getter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F10 |
| getters |
| abstract v |
| reference: <testLibrary>::@class::D::@getter::v |
| firstFragment: #F11 |
| returnType: int |
| variable: <testLibrary>::@class::D::@field::v |
| '''); |
| } |
| |
| test_class_field_implicit_type() async { |
| var library = await buildLibrary('class C { var x; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F6 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_implicit_type_late() async { |
| var library = await buildLibrary('class C { late var x; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @19 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| late x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F6 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_inferred_type_nonStatic_explicit_initialized() async { |
| var library = await buildLibrary('class C { num v = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer v @14 |
| element: <testLibrary>::@class::C::@field::v |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic v |
| element: <testLibrary>::@class::C::@getter::v |
| returnType: num |
| setters |
| #F5 synthetic v |
| element: <testLibrary>::@class::C::@setter::v |
| formalParameters |
| #F6 _v |
| element: <testLibrary>::@class::C::@setter::v::@formalParameter::_v |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer v |
| reference: <testLibrary>::@class::C::@field::v |
| firstFragment: #F2 |
| type: num |
| getter: <testLibrary>::@class::C::@getter::v |
| setter: <testLibrary>::@class::C::@setter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic v |
| reference: <testLibrary>::@class::C::@getter::v |
| firstFragment: #F4 |
| returnType: num |
| variable: <testLibrary>::@class::C::@field::v |
| setters |
| synthetic v |
| reference: <testLibrary>::@class::C::@setter::v |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F6 |
| type: num |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_inferred_type_nonStatic_implicit_initialized() async { |
| var library = await buildLibrary('class C { var v = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer v @14 |
| element: <testLibrary>::@class::C::@field::v |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic v |
| element: <testLibrary>::@class::C::@getter::v |
| returnType: int |
| setters |
| #F5 synthetic v |
| element: <testLibrary>::@class::C::@setter::v |
| formalParameters |
| #F6 _v |
| element: <testLibrary>::@class::C::@setter::v::@formalParameter::_v |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer v |
| reference: <testLibrary>::@class::C::@field::v |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::v |
| setter: <testLibrary>::@class::C::@setter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic v |
| reference: <testLibrary>::@class::C::@getter::v |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::v |
| setters |
| synthetic v |
| reference: <testLibrary>::@class::C::@setter::v |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_inferred_type_nonStatic_implicit_uninitialized() async { |
| var library = await buildLibrary( |
| 'class C extends D { var v; } abstract class D { int get v; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 v @24 |
| element: <testLibrary>::@class::C::@field::v |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic v |
| element: <testLibrary>::@class::C::@getter::v |
| returnType: int |
| setters |
| #F5 synthetic v |
| element: <testLibrary>::@class::C::@setter::v |
| formalParameters |
| #F6 _v |
| element: <testLibrary>::@class::C::@setter::v::@formalParameter::_v |
| #F7 class D @44 |
| element: <testLibrary>::@class::D |
| fields |
| #F8 synthetic v |
| element: <testLibrary>::@class::D::@field::v |
| constructors |
| #F9 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| getters |
| #F10 v @56 |
| element: <testLibrary>::@class::D::@getter::v |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| fields |
| v |
| reference: <testLibrary>::@class::C::@field::v |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::v |
| setter: <testLibrary>::@class::C::@setter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| getters |
| synthetic v |
| reference: <testLibrary>::@class::C::@getter::v |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::v |
| setters |
| synthetic v |
| reference: <testLibrary>::@class::C::@setter::v |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| abstract class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F7 |
| fields |
| synthetic v |
| reference: <testLibrary>::@class::D::@field::v |
| firstFragment: #F8 |
| type: int |
| getter: <testLibrary>::@class::D::@getter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F9 |
| getters |
| abstract v |
| reference: <testLibrary>::@class::D::@getter::v |
| firstFragment: #F10 |
| returnType: int |
| variable: <testLibrary>::@class::D::@field::v |
| '''); |
| } |
| |
| test_class_field_inferred_type_nonStatic_inherited_resolveInitializer() async { |
| var library = await buildLibrary(r''' |
| const a = 0; |
| abstract class A { |
| const A(); |
| List<int> get f; |
| } |
| class B extends A { |
| const B(); |
| final f = [a]; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @28 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic f |
| element: <testLibrary>::@class::A::@field::f |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 40 |
| getters |
| #F4 f @61 |
| element: <testLibrary>::@class::A::@getter::f |
| returnType: List<int> |
| #F5 class B @72 |
| element: <testLibrary>::@class::B |
| fields |
| #F6 hasInitializer f @107 |
| element: <testLibrary>::@class::B::@field::f |
| initializer: expression_0 |
| ListLiteral |
| leftBracket: [ @111 |
| elements |
| SimpleIdentifier |
| token: a @112 |
| element: <testLibrary>::@getter::a |
| staticType: int |
| rightBracket: ] @113 |
| staticType: List<int> |
| constructors |
| #F7 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 94 |
| getters |
| #F8 synthetic f |
| element: <testLibrary>::@class::B::@getter::f |
| returnType: List<int> |
| topLevelVariables |
| #F9 hasInitializer a @6 |
| element: <testLibrary>::@topLevelVariable::a |
| initializer: expression_1 |
| IntegerLiteral |
| literal: 0 @10 |
| staticType: int |
| getters |
| #F10 synthetic a |
| element: <testLibrary>::@getter::a |
| returnType: int |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic f |
| reference: <testLibrary>::@class::A::@field::f |
| firstFragment: #F2 |
| type: List<int> |
| getter: <testLibrary>::@class::A::@getter::f |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| abstract f |
| reference: <testLibrary>::@class::A::@getter::f |
| firstFragment: #F4 |
| returnType: List<int> |
| variable: <testLibrary>::@class::A::@field::f |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| fields |
| final hasInitializer f |
| reference: <testLibrary>::@class::B::@field::f |
| firstFragment: #F6 |
| type: List<int> |
| constantInitializer |
| fragment: #F6 |
| expression: expression_0 |
| getter: <testLibrary>::@class::B::@getter::f |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic f |
| reference: <testLibrary>::@class::B::@getter::f |
| firstFragment: #F8 |
| returnType: List<int> |
| variable: <testLibrary>::@class::B::@field::f |
| topLevelVariables |
| const hasInitializer a |
| reference: <testLibrary>::@topLevelVariable::a |
| firstFragment: #F9 |
| type: int |
| constantInitializer |
| fragment: #F9 |
| expression: expression_1 |
| getter: <testLibrary>::@getter::a |
| getters |
| synthetic static a |
| reference: <testLibrary>::@getter::a |
| firstFragment: #F10 |
| returnType: int |
| variable: <testLibrary>::@topLevelVariable::a |
| '''); |
| } |
| |
| test_class_field_inferred_type_static_implicit_initialized() async { |
| var library = await buildLibrary('class C { static var v = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer v @21 |
| element: <testLibrary>::@class::C::@field::v |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic v |
| element: <testLibrary>::@class::C::@getter::v |
| returnType: int |
| setters |
| #F5 synthetic v |
| element: <testLibrary>::@class::C::@setter::v |
| formalParameters |
| #F6 _v |
| element: <testLibrary>::@class::C::@setter::v::@formalParameter::_v |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static hasInitializer v |
| reference: <testLibrary>::@class::C::@field::v |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::v |
| setter: <testLibrary>::@class::C::@setter::v |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static v |
| reference: <testLibrary>::@class::C::@getter::v |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::v |
| setters |
| synthetic static v |
| reference: <testLibrary>::@class::C::@setter::v |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_inheritedContextType_double() async { |
| var library = await buildLibrary(''' |
| abstract class A { |
| const A(); |
| double get foo; |
| } |
| class B extends A { |
| const B(); |
| final foo = 2; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @15 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 27 |
| getters |
| #F4 foo @45 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: double |
| #F5 class B @58 |
| element: <testLibrary>::@class::B |
| fields |
| #F6 hasInitializer foo @93 |
| element: <testLibrary>::@class::B::@field::foo |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 2 @99 |
| staticType: double |
| constructors |
| #F7 const new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeNameOffset: 80 |
| getters |
| #F8 synthetic foo |
| element: <testLibrary>::@class::B::@getter::foo |
| returnType: double |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: double |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| abstract foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: double |
| variable: <testLibrary>::@class::A::@field::foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| fields |
| final hasInitializer foo |
| reference: <testLibrary>::@class::B::@field::foo |
| firstFragment: #F6 |
| type: double |
| constantInitializer |
| fragment: #F6 |
| expression: expression_0 |
| getter: <testLibrary>::@class::B::@getter::foo |
| constructors |
| const new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::B::@getter::foo |
| firstFragment: #F8 |
| returnType: double |
| variable: <testLibrary>::@class::B::@field::foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_abstractGetter() async { |
| var library = await buildLibrary(r''' |
| abstract class A { |
| int? get _foo; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @15 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic _foo |
| element: <testLibrary>::@class::A::@field::_foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 _foo @30 |
| element: <testLibrary>::@class::A::@getter::_foo |
| returnType: int? |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F2 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| abstract _foo |
| reference: <testLibrary>::@class::A::@getter::_foo |
| firstFragment: #F4 |
| returnType: int? |
| variable: <testLibrary>::@class::A::@field::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasGetter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| int? get _foo => 0; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingGetters |
| <testLibrary>::@class::B::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasGetter_abstract() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| abstract class B { |
| int? get _foo; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasGetter_inPart() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| class B { |
| int? get _foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingGetters |
| <testLibrary>::@class::B::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasGetter_static() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| static int? get _foo => 0; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasNotFinalField() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| int? _foo; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingFields |
| <testLibrary>::@class::B::@field::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasNotFinalField_static() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| static int? _foo; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_hasSetter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| set _field(int? _) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_language217() async { |
| var library = await buildLibrary(r''' |
| // @dart = 2.19 |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_field() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| final int? _foo = 0; |
| } |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| class C implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@class::C |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_field_implementedInMixin() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| mixin M { |
| final int? _foo = 0; |
| } |
| |
| class B { |
| final int? _foo = 0; |
| } |
| |
| /// `_foo` is implemented in [M]. |
| class C with M implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields( |
| classNames: {'A', 'B'}, |
| mixinNames: {'M'}, |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F2 |
| fields |
| final promotable hasInitializer _foo |
| reference: <testLibrary>::@class::B::@field::_foo |
| firstFragment: #F3 |
| type: int? |
| getter: <testLibrary>::@class::B::@getter::_foo |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F4 |
| superclassConstraints |
| Object |
| fields |
| final promotable hasInitializer _foo |
| reference: <testLibrary>::@mixin::M::@field::_foo |
| firstFragment: #F5 |
| type: int? |
| getter: <testLibrary>::@mixin::M::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_field_implementedInSuperclass() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| final int? _foo = 0; |
| } |
| |
| class C { |
| final int? _foo = 0; |
| } |
| |
| /// `_foo` is implemented in [B]. |
| class D extends B implements C { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A', 'B'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F2 |
| fields |
| final promotable hasInitializer _foo |
| reference: <testLibrary>::@class::B::@field::_foo |
| firstFragment: #F3 |
| type: int? |
| getter: <testLibrary>::@class::B::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_field_inClassTypeAlias() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| final int? _foo = 0; |
| } |
| |
| mixin M { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| class E = Object with M implements B; |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@class::E |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_field_inEnum() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B { |
| final int? _foo = 0; |
| } |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| enum E implements B { |
| v; |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A', 'B'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F2 |
| fields |
| final hasInitializer _foo |
| reference: <testLibrary>::@class::B::@field::_foo |
| firstFragment: #F3 |
| type: int? |
| getter: <testLibrary>::@class::B::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@enum::E |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_getter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| abstract class B { |
| int? get _foo; |
| } |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| class C implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@class::C |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_inDifferentLibrary() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class B { |
| int? get _foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| import 'a.dart'; |
| |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| /// Has a noSuchMethod thrower for B._field, but since private names in |
| /// different libraries are distinct, this has no effect on promotion of |
| /// C._field. |
| class C implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_inheritedInterface() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| class B extends A { |
| A(super.value); |
| } |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| class C implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@class::C |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_mixedInterface() async { |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| mixin M { |
| final int? _foo = 0; |
| } |
| |
| class B with M {} |
| |
| /// Implicitly implements `_foo` as a getter that forwards to [noSuchMethod]. |
| class C implements B { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}, mixinNames: {'M'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F2 |
| superclassConstraints |
| Object |
| fields |
| final hasInitializer _foo |
| reference: <testLibrary>::@mixin::M::@field::_foo |
| firstFragment: #F3 |
| type: int? |
| getter: <testLibrary>::@mixin::M::@getter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingNsmClasses |
| <testLibrary>::@class::C |
| '''); |
| } |
| |
| test_class_field_isPromotable_noSuchMethodForwarder_unusedMixin() async { |
| // Mixins are implicitly abstract so the presence of a mixin that inherits |
| // a field into its interface, and doesn't implement it, doesn't mean that |
| // a noSuchMethod forwarder created for it. So, this does not block that |
| // field from promoting. |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| A(this._foo); |
| } |
| |
| mixin M implements A { |
| dynamic noSuchMethod(Invocation invocation) {} |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_notFinal() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int? _foo; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| setter: <testLibrary>::@class::A::@setter::_foo |
| fieldNameNonPromotabilityInfo |
| _foo |
| conflictingFields |
| <testLibrary>::@class::A::@field::_foo |
| '''); |
| } |
| |
| test_class_field_isPromotable_notPrivate() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int? field; |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| field |
| reference: <testLibrary>::@class::A::@field::field |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::field |
| setter: <testLibrary>::@class::A::@setter::field |
| '''); |
| } |
| |
| test_class_field_isPromotable_typeInference() async { |
| // We decide that `_foo` is promotable before inferring the type of `bar`. |
| var library = await buildLibrary(r''' |
| class A { |
| final int? _foo; |
| final bar = _foo != null ? _foo : 0; |
| A(this._foo); |
| } |
| '''); |
| |
| configuration.forPromotableFields(classNames: {'A'}); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F0 |
| fields |
| final promotable _foo |
| reference: <testLibrary>::@class::A::@field::_foo |
| firstFragment: #F1 |
| type: int? |
| getter: <testLibrary>::@class::A::@getter::_foo |
| final hasInitializer bar |
| reference: <testLibrary>::@class::A::@field::bar |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::bar |
| '''); |
| } |
| |
| test_class_field_missingName() async { |
| var library = await buildLibrary(''' |
| abstract class C { |
| Object a,; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 a @28 |
| element: <testLibrary>::@class::C::@field::a |
| #F3 <null-name> (offset=30) |
| element: <testLibrary>::@class::C::@field::0 |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic a |
| element: <testLibrary>::@class::C::@getter::a |
| returnType: Object |
| #F6 synthetic <null-name> |
| element: <testLibrary>::@class::C::@getter::1 |
| returnType: Object |
| setters |
| #F7 synthetic a |
| element: <testLibrary>::@class::C::@setter::a |
| formalParameters |
| #F8 _a |
| element: <testLibrary>::@class::C::@setter::a::@formalParameter::_a |
| #F9 synthetic <null-name> |
| element: <testLibrary>::@class::C::@setter::2 |
| formalParameters |
| #F10 _ |
| element: <testLibrary>::@class::C::@setter::2::@formalParameter::_ |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| a |
| reference: <testLibrary>::@class::C::@field::a |
| firstFragment: #F2 |
| type: Object |
| getter: <testLibrary>::@class::C::@getter::a |
| setter: <testLibrary>::@class::C::@setter::a |
| <null-name> |
| reference: <testLibrary>::@class::C::@field::0 |
| firstFragment: #F3 |
| type: Object |
| getter: <testLibrary>::@class::C::@getter::1 |
| setter: <testLibrary>::@class::C::@setter::2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic a |
| reference: <testLibrary>::@class::C::@getter::a |
| firstFragment: #F5 |
| returnType: Object |
| variable: <testLibrary>::@class::C::@field::a |
| synthetic <null-name> |
| reference: <testLibrary>::@class::C::@getter::1 |
| firstFragment: #F6 |
| returnType: Object |
| variable: <testLibrary>::@class::C::@field::0 |
| setters |
| synthetic a |
| reference: <testLibrary>::@class::C::@setter::a |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional _a |
| firstFragment: #F8 |
| type: Object |
| returnType: void |
| synthetic <null-name> |
| reference: <testLibrary>::@class::C::@setter::2 |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F10 |
| type: Object |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_ofGeneric_refEnclosingTypeParameter_false() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| late int foo; |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 foo @24 |
| element: <testLibrary>::@class::C::@field::foo |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F6 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| late foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_ofGeneric_refEnclosingTypeParameter_true() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| late T foo; |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 foo @22 |
| element: <testLibrary>::@class::C::@field::foo |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: T |
| setters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F6 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| late foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| type: T |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| hasEnclosingTypeParameterReference: true |
| returnType: T |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F5 |
| hasEnclosingTypeParameterReference: true |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F6 |
| type: T |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_propagatedType_const_noDep() async { |
| var library = await buildLibrary(''' |
| class C { |
| static const x = 0; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @25 |
| element: <testLibrary>::@class::C::@field::x |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @29 |
| staticType: int |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static const hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| constantInitializer |
| fragment: #F2 |
| expression: expression_0 |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_propagatedType_final_dep_inLib() async { |
| newFile('$testPackageLibPath/a.dart', 'final a = 1;'); |
| var library = await buildLibrary(''' |
| import "a.dart"; |
| class C { |
| final b = a / 2; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| classes |
| #F1 class C @23 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer b @35 |
| element: <testLibrary>::@class::C::@field::b |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic b |
| element: <testLibrary>::@class::C::@getter::b |
| returnType: double |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final hasInitializer b |
| reference: <testLibrary>::@class::C::@field::b |
| firstFragment: #F2 |
| type: double |
| getter: <testLibrary>::@class::C::@getter::b |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic b |
| reference: <testLibrary>::@class::C::@getter::b |
| firstFragment: #F4 |
| returnType: double |
| variable: <testLibrary>::@class::C::@field::b |
| '''); |
| } |
| |
| test_class_field_propagatedType_final_dep_inPart() async { |
| newFile('$testPackageLibPath/a.dart', 'part of lib; final a = 1;'); |
| var library = await buildLibrary(''' |
| library lib; |
| part "a.dart"; |
| class C { |
| final b = a / 2; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| name: lib |
| fragments |
| #F0 <testLibraryFragment> (offset=8) |
| element: <testLibrary> |
| nextFragment: #F1 |
| parts |
| part_0 |
| uri: package:test/a.dart |
| unit: #F1 |
| classes |
| #F2 class C @34 |
| element: <testLibrary>::@class::C |
| fields |
| #F3 hasInitializer b @46 |
| element: <testLibrary>::@class::C::@field::b |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic b |
| element: <testLibrary>::@class::C::@getter::b |
| returnType: double |
| #F1 package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: #F0 |
| previousFragment: #F0 |
| topLevelVariables |
| #F6 hasInitializer a @19 |
| element: <testLibrary>::@topLevelVariable::a |
| getters |
| #F7 synthetic a |
| element: <testLibrary>::@getter::a |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F2 |
| fields |
| final hasInitializer b |
| reference: <testLibrary>::@class::C::@field::b |
| firstFragment: #F3 |
| type: double |
| getter: <testLibrary>::@class::C::@getter::b |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic b |
| reference: <testLibrary>::@class::C::@getter::b |
| firstFragment: #F5 |
| returnType: double |
| variable: <testLibrary>::@class::C::@field::b |
| topLevelVariables |
| final hasInitializer a |
| reference: <testLibrary>::@topLevelVariable::a |
| firstFragment: #F6 |
| type: int |
| getter: <testLibrary>::@getter::a |
| getters |
| synthetic static a |
| reference: <testLibrary>::@getter::a |
| firstFragment: #F7 |
| returnType: int |
| variable: <testLibrary>::@topLevelVariable::a |
| '''); |
| } |
| |
| test_class_field_propagatedType_final_noDep_instance() async { |
| var library = await buildLibrary(''' |
| class C { |
| final x = 0; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @18 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_propagatedType_final_noDep_static() async { |
| var library = await buildLibrary(''' |
| class C { |
| static final x = 0; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @25 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static final hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_static() async { |
| var library = await buildLibrary('class C { static int i; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 i @21 |
| element: <testLibrary>::@class::C::@field::i |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| setters |
| #F5 synthetic i |
| element: <testLibrary>::@class::C::@setter::i |
| formalParameters |
| #F6 _i |
| element: <testLibrary>::@class::C::@setter::i::@formalParameter::_i |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::i |
| setter: <testLibrary>::@class::C::@setter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| setters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@setter::i |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _i |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_static_final_hasConstConstructor() async { |
| var library = await buildLibrary(''' |
| class C { |
| static final f = 0; |
| const C(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer f @25 |
| element: <testLibrary>::@class::C::@field::f |
| constructors |
| #F3 const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeNameOffset: 40 |
| getters |
| #F4 synthetic f |
| element: <testLibrary>::@class::C::@getter::f |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static final hasInitializer f |
| reference: <testLibrary>::@class::C::@field::f |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::f |
| constructors |
| const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static f |
| reference: <testLibrary>::@class::C::@getter::f |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::f |
| '''); |
| } |
| |
| test_class_field_static_final_untyped() async { |
| var library = await buildLibrary('class C { static final x = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @23 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static final hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_field_static_late() async { |
| var library = await buildLibrary('class C { static late int i; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 i @26 |
| element: <testLibrary>::@class::C::@field::i |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| setters |
| #F5 synthetic i |
| element: <testLibrary>::@class::C::@setter::i |
| formalParameters |
| #F6 _i |
| element: <testLibrary>::@class::C::@setter::i::@formalParameter::_i |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| static late i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::i |
| setter: <testLibrary>::@class::C::@setter::i |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| setters |
| synthetic static i |
| reference: <testLibrary>::@class::C::@setter::i |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _i |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_type_explicit() async { |
| var library = await buildLibrary(r''' |
| class C { |
| int a = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer a @16 |
| element: <testLibrary>::@class::C::@field::a |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic a |
| element: <testLibrary>::@class::C::@getter::a |
| returnType: int |
| setters |
| #F5 synthetic a |
| element: <testLibrary>::@class::C::@setter::a |
| formalParameters |
| #F6 _a |
| element: <testLibrary>::@class::C::@setter::a::@formalParameter::_a |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer a |
| reference: <testLibrary>::@class::C::@field::a |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::a |
| setter: <testLibrary>::@class::C::@setter::a |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic a |
| reference: <testLibrary>::@class::C::@getter::a |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::a |
| setters |
| synthetic a |
| reference: <testLibrary>::@class::C::@setter::a |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _a |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_type_inferred_fromInitializer() async { |
| var library = await buildLibrary(r''' |
| class C { |
| var foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer foo @16 |
| element: <testLibrary>::@class::C::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F6 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_type_inferred_fromSuper() async { |
| var library = await buildLibrary(r''' |
| abstract class A { |
| int get foo; |
| } |
| |
| class B extends A { |
| final foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @15 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 foo @29 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| #F5 class B @43 |
| element: <testLibrary>::@class::B |
| fields |
| #F6 hasInitializer foo @65 |
| element: <testLibrary>::@class::B::@field::foo |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| getters |
| #F8 synthetic foo |
| element: <testLibrary>::@class::B::@getter::foo |
| returnType: int |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| abstract foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| fields |
| final hasInitializer foo |
| reference: <testLibrary>::@class::B::@field::foo |
| firstFragment: #F6 |
| type: int |
| getter: <testLibrary>::@class::B::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::B::@getter::foo |
| firstFragment: #F8 |
| returnType: int |
| variable: <testLibrary>::@class::B::@field::foo |
| '''); |
| } |
| |
| test_class_field_type_inferred_Never() async { |
| var library = await buildLibrary(r''' |
| class C { |
| var a = throw 42; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer a @16 |
| element: <testLibrary>::@class::C::@field::a |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic a |
| element: <testLibrary>::@class::C::@getter::a |
| returnType: Never |
| setters |
| #F5 synthetic a |
| element: <testLibrary>::@class::C::@setter::a |
| formalParameters |
| #F6 _a |
| element: <testLibrary>::@class::C::@setter::a::@formalParameter::_a |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer a |
| reference: <testLibrary>::@class::C::@field::a |
| firstFragment: #F2 |
| type: Never |
| getter: <testLibrary>::@class::C::@getter::a |
| setter: <testLibrary>::@class::C::@setter::a |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic a |
| reference: <testLibrary>::@class::C::@getter::a |
| firstFragment: #F4 |
| returnType: Never |
| variable: <testLibrary>::@class::C::@field::a |
| setters |
| synthetic a |
| reference: <testLibrary>::@class::C::@setter::a |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _a |
| firstFragment: #F6 |
| type: Never |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_typed() async { |
| var library = await buildLibrary('class C { int x = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_field_untyped() async { |
| var library = await buildLibrary('class C { var x = 0; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer x @14 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 _x |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::_x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| hasInitializer x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| synthetic x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fields() async { |
| var library = await buildLibrary('class C { int i; int j; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 i @14 |
| element: <testLibrary>::@class::C::@field::i |
| #F3 j @21 |
| element: <testLibrary>::@class::C::@field::j |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic i |
| element: <testLibrary>::@class::C::@getter::i |
| returnType: int |
| #F6 synthetic j |
| element: <testLibrary>::@class::C::@getter::j |
| returnType: int |
| setters |
| #F7 synthetic i |
| element: <testLibrary>::@class::C::@setter::i |
| formalParameters |
| #F8 _i |
| element: <testLibrary>::@class::C::@setter::i::@formalParameter::_i |
| #F9 synthetic j |
| element: <testLibrary>::@class::C::@setter::j |
| formalParameters |
| #F10 _j |
| element: <testLibrary>::@class::C::@setter::j::@formalParameter::_j |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| i |
| reference: <testLibrary>::@class::C::@field::i |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::i |
| setter: <testLibrary>::@class::C::@setter::i |
| j |
| reference: <testLibrary>::@class::C::@field::j |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::j |
| setter: <testLibrary>::@class::C::@setter::j |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic i |
| reference: <testLibrary>::@class::C::@getter::i |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::i |
| synthetic j |
| reference: <testLibrary>::@class::C::@getter::j |
| firstFragment: #F6 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::j |
| setters |
| synthetic i |
| reference: <testLibrary>::@class::C::@setter::i |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional _i |
| firstFragment: #F8 |
| type: int |
| returnType: void |
| synthetic j |
| reference: <testLibrary>::@class::C::@setter::j |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional _j |
| firstFragment: #F10 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fields_late() async { |
| var library = await buildLibrary(''' |
| class C { |
| late int foo; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 foo @21 |
| element: <testLibrary>::@class::C::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F6 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| late foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fields_late_final() async { |
| var library = await buildLibrary(''' |
| class C { |
| late final int foo; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 foo @27 |
| element: <testLibrary>::@class::C::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F6 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| late final foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fields_late_final_initialized() async { |
| var library = await buildLibrary(''' |
| class C { |
| late final int foo = 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 hasInitializer foo @27 |
| element: <testLibrary>::@class::C::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| late final hasInitializer foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| '''); |
| } |
| |
| test_class_fields_late_inference_usingSuper_methodInvocation() async { |
| var library = await buildLibrary(''' |
| class A { |
| int foo() => 0; |
| } |
| |
| class B extends A { |
| late var f = super.foo(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 foo @16 |
| element: <testLibrary>::@class::A::@method::foo |
| #F4 class B @37 |
| element: <testLibrary>::@class::B |
| fields |
| #F5 hasInitializer f @62 |
| element: <testLibrary>::@class::B::@field::f |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| getters |
| #F7 synthetic f |
| element: <testLibrary>::@class::B::@getter::f |
| returnType: int |
| setters |
| #F8 synthetic f |
| element: <testLibrary>::@class::B::@setter::f |
| formalParameters |
| #F9 _f |
| element: <testLibrary>::@class::B::@setter::f::@formalParameter::_f |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: #F3 |
| returnType: int |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A |
| fields |
| late hasInitializer f |
| reference: <testLibrary>::@class::B::@field::f |
| firstFragment: #F5 |
| type: int |
| getter: <testLibrary>::@class::B::@getter::f |
| setter: <testLibrary>::@class::B::@setter::f |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F6 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic f |
| reference: <testLibrary>::@class::B::@getter::f |
| firstFragment: #F7 |
| returnType: int |
| variable: <testLibrary>::@class::B::@field::f |
| setters |
| synthetic f |
| reference: <testLibrary>::@class::B::@setter::f |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional _f |
| firstFragment: #F9 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fields_late_inference_usingSuper_propertyAccess() async { |
| var library = await buildLibrary(''' |
| class A { |
| int get foo => 0; |
| } |
| |
| class B extends A { |
| late var f = super.foo; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 foo @20 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| #F5 class B @39 |
| element: <testLibrary>::@class::B |
| fields |
| #F6 hasInitializer f @64 |
| element: <testLibrary>::@class::B::@field::f |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| getters |
| #F8 synthetic f |
| element: <testLibrary>::@class::B::@getter::f |
| returnType: int |
| setters |
| #F9 synthetic f |
| element: <testLibrary>::@class::B::@setter::f |
| formalParameters |
| #F10 _f |
| element: <testLibrary>::@class::B::@setter::f::@formalParameter::_f |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| fields |
| late hasInitializer f |
| reference: <testLibrary>::@class::B::@field::f |
| firstFragment: #F6 |
| type: int |
| getter: <testLibrary>::@class::B::@getter::f |
| setter: <testLibrary>::@class::B::@setter::f |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic f |
| reference: <testLibrary>::@class::B::@getter::f |
| firstFragment: #F8 |
| returnType: int |
| variable: <testLibrary>::@class::B::@field::f |
| setters |
| synthetic f |
| reference: <testLibrary>::@class::B::@setter::f |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional _f |
| firstFragment: #F10 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_final() async { |
| var library = await buildLibrary('final class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @12 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| final class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_fragmentOrder_g1_s2_s1() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int get a => 0; |
| set b(int _) {} |
| set a(int _) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic a |
| element: <testLibrary>::@class::A::@field::a |
| #F3 synthetic b |
| element: <testLibrary>::@class::A::@field::b |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F5 a @20 |
| element: <testLibrary>::@class::A::@getter::a |
| returnType: int |
| setters |
| #F6 b @34 |
| element: <testLibrary>::@class::A::@setter::b |
| formalParameters |
| #F7 _ @40 |
| element: <testLibrary>::@class::A::@setter::b::@formalParameter::_ |
| #F8 a @52 |
| element: <testLibrary>::@class::A::@setter::a |
| formalParameters |
| #F9 _ @58 |
| element: <testLibrary>::@class::A::@setter::a::@formalParameter::_ |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic a |
| reference: <testLibrary>::@class::A::@field::a |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::a |
| setter: <testLibrary>::@class::A::@setter::a |
| synthetic b |
| reference: <testLibrary>::@class::A::@field::b |
| firstFragment: #F3 |
| type: int |
| setter: <testLibrary>::@class::A::@setter::b |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F4 |
| getters |
| a |
| reference: <testLibrary>::@class::A::@getter::a |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::a |
| setters |
| b |
| reference: <testLibrary>::@class::A::@setter::b |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| a |
| reference: <testLibrary>::@class::A::@setter::a |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F9 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_fragmentOrder_s1_g2_g1() async { |
| var library = await buildLibrary(r''' |
| class A { |
| set a(int _) {} |
| int get b => 0; |
| int get a => 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic a |
| element: <testLibrary>::@class::A::@field::a |
| #F3 synthetic b |
| element: <testLibrary>::@class::A::@field::b |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F5 b @38 |
| element: <testLibrary>::@class::A::@getter::b |
| returnType: int |
| #F6 a @56 |
| element: <testLibrary>::@class::A::@getter::a |
| returnType: int |
| setters |
| #F7 a @16 |
| element: <testLibrary>::@class::A::@setter::a |
| formalParameters |
| #F8 _ @22 |
| element: <testLibrary>::@class::A::@setter::a::@formalParameter::_ |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic a |
| reference: <testLibrary>::@class::A::@field::a |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::a |
| setter: <testLibrary>::@class::A::@setter::a |
| synthetic b |
| reference: <testLibrary>::@class::A::@field::b |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::b |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F4 |
| getters |
| b |
| reference: <testLibrary>::@class::A::@getter::b |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::b |
| a |
| reference: <testLibrary>::@class::A::@getter::a |
| firstFragment: #F6 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::a |
| setters |
| a |
| reference: <testLibrary>::@class::A::@setter::a |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F8 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_getter_abstract() async { |
| var library = await buildLibrary('abstract class C { int get x; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @27 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| abstract x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_getter_external() async { |
| var library = await buildLibrary('class C { external int get x; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @27 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| external x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_getter_implicit_return_type() async { |
| var library = await buildLibrary('class C { get x => null; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @14 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_getter_invokesSuperSelf_getter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int get foo { |
| super.foo; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 foo @20 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| '''); |
| } |
| |
| test_class_getter_invokesSuperSelf_getter_nestedInAssignment() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int get foo { |
| (super.foo).foo = 0; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 foo @20 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| '''); |
| } |
| |
| test_class_getter_invokesSuperSelf_setter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| int get foo { |
| super.foo = 0; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 foo @20 |
| element: <testLibrary>::@class::A::@getter::foo |
| returnType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| foo |
| reference: <testLibrary>::@class::A::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::foo |
| '''); |
| } |
| |
| test_class_getter_missingName() async { |
| var library = await buildLibrary(''' |
| class A { |
| get () => 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 get @12 |
| element: <testLibrary>::@class::A::@method::get |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| get |
| reference: <testLibrary>::@class::A::@method::get |
| firstFragment: #F3 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_getter_native() async { |
| var library = await buildLibrary(''' |
| class C { |
| int get x() native; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @20 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| external x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_getter_ofGeneric_refEnclosingTypeParameter_false() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| int get foo {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo |
| getters |
| #F4 foo @23 |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| getters |
| foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| '''); |
| } |
| |
| test_class_getter_ofGeneric_refEnclosingTypeParameter_true() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| T get foo {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo |
| getters |
| #F4 foo @21 |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: T |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| type: T |
| getter: <testLibrary>::@class::C::@getter::foo |
| getters |
| foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F4 |
| hasEnclosingTypeParameterReference: true |
| returnType: T |
| variable: <testLibrary>::@class::C::@field::foo |
| '''); |
| } |
| |
| test_class_getter_static() async { |
| var library = await buildLibrary('class C { static int get x => null; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @25 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic static x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| static x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| '''); |
| } |
| |
| test_class_getters() async { |
| var library = await buildLibrary( |
| 'class C { int get x => null; get y => null; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| #F3 synthetic y |
| element: <testLibrary>::@class::C::@field::y |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 x @18 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| #F6 y @33 |
| element: <testLibrary>::@class::C::@getter::y |
| returnType: dynamic |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| synthetic y |
| reference: <testLibrary>::@class::C::@field::y |
| firstFragment: #F3 |
| type: dynamic |
| getter: <testLibrary>::@class::C::@getter::y |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| y |
| reference: <testLibrary>::@class::C::@getter::y |
| firstFragment: #F6 |
| returnType: dynamic |
| variable: <testLibrary>::@class::C::@field::y |
| '''); |
| } |
| |
| test_class_implicitField_getterFirst() async { |
| var library = await buildLibrary(''' |
| class C { |
| int get x => 0; |
| void set x(int value) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @20 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F5 x @39 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 value @45 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_implicitField_setterFirst() async { |
| var library = await buildLibrary(''' |
| class C { |
| void set x(int value) {} |
| int get x => 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F4 x @47 |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: int |
| setters |
| #F5 x @21 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 value @27 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::x |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| getters |
| x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::x |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_interface() async { |
| var library = await buildLibrary('interface class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @16 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| interface class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_interfaces() async { |
| var library = await buildLibrary(''' |
| class C implements D, E {} |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @33 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @44 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| interfaces |
| D |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_interfaces_extensionType() async { |
| var library = await buildLibrary(''' |
| class A {} |
| extension type B(int it) {} |
| class C {} |
| class D implements A, B, C {} |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| #F2 class C @45 |
| element: <testLibrary>::@class::C |
| #F3 class D @56 |
| element: <testLibrary>::@class::D |
| extensionTypes |
| #F4 extension type B @26 |
| element: <testLibrary>::@extensionType::B |
| fields |
| #F5 it @32 |
| element: <testLibrary>::@extensionType::B::@field::it |
| getters |
| #F6 synthetic it |
| element: <testLibrary>::@extensionType::B::@getter::it |
| returnType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F2 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| interfaces |
| A |
| C |
| extensionTypes |
| extension type B |
| reference: <testLibrary>::@extensionType::B |
| firstFragment: #F4 |
| representation: <testLibrary>::@extensionType::B::@field::it |
| primaryConstructor: <testLibrary>::@extensionType::B::@constructor::new |
| typeErasure: int |
| fields |
| final it |
| reference: <testLibrary>::@extensionType::B::@field::it |
| firstFragment: #F5 |
| type: int |
| getter: <testLibrary>::@extensionType::B::@getter::it |
| getters |
| synthetic it |
| reference: <testLibrary>::@extensionType::B::@getter::it |
| firstFragment: #F6 |
| returnType: int |
| variable: <testLibrary>::@extensionType::B::@field::it |
| '''); |
| } |
| |
| test_class_interfaces_Function() async { |
| var library = await buildLibrary(''' |
| class A {} |
| class B {} |
| class C implements A, Function, B {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @17 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| #F5 class C @28 |
| element: <testLibrary>::@class::C |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F5 |
| interfaces |
| A |
| B |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_interfaces_unresolved() async { |
| var library = await buildLibrary( |
| 'class C implements X, Y, Z {} class X {} class Z {}', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class X @36 |
| element: <testLibrary>::@class::X |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::X::@constructor::new |
| typeName: X |
| #F5 class Z @47 |
| element: <testLibrary>::@class::Z |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::Z::@constructor::new |
| typeName: Z |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| interfaces |
| X |
| Z |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| class X |
| reference: <testLibrary>::@class::X |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::X::@constructor::new |
| firstFragment: #F4 |
| class Z |
| reference: <testLibrary>::@class::Z |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::Z::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_lazy_constructors() async { |
| var library = await buildLibrary(''' |
| class A { |
| A.named(); |
| } |
| '''); |
| |
| var constructors = library.getClass2('A')!.constructors; |
| expect(constructors, hasLength(1)); |
| } |
| |
| test_class_lazy_fields() async { |
| var library = await buildLibrary(''' |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| var fields = library.getClass2('A')!.fields; |
| expect(fields, hasLength(1)); |
| } |
| |
| test_class_lazy_getters() async { |
| var library = await buildLibrary(''' |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| var getters = library.getClass2('A')!.getters; |
| expect(getters, hasLength(1)); |
| } |
| |
| test_class_lazy_methods() async { |
| var library = await buildLibrary(''' |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| var methods = library.getClass2('A')!.methods; |
| expect(methods, hasLength(1)); |
| } |
| |
| test_class_lazy_setters() async { |
| var library = await buildLibrary(''' |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| var setters = library.getClass2('A')!.setters; |
| expect(setters, hasLength(1)); |
| } |
| |
| test_class_method_abstract() async { |
| var library = await buildLibrary('abstract class C { f(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @19 |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| abstract f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_async() async { |
| var library = await buildLibrary(r''' |
| import 'dart:async'; |
| class C { |
| Future f() async {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| dart:async |
| classes |
| #F1 class C @27 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @40 async |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: Future<dynamic> |
| '''); |
| } |
| |
| test_class_method_asyncStar() async { |
| var library = await buildLibrary(r''' |
| import 'dart:async'; |
| class C { |
| Stream f() async* {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| dart:async |
| classes |
| #F1 class C @27 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @40 async* |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: Stream<dynamic> |
| '''); |
| } |
| |
| test_class_method_documented() async { |
| var library = await buildLibrary(''' |
| class C { |
| /** |
| * Docs |
| */ |
| f() {} |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @34 |
| element: <testLibrary>::@class::C::@method::f |
| documentationComment: /**\n * Docs\n */ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| documentationComment: /**\n * Docs\n */ |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_external() async { |
| var library = await buildLibrary('class C { external f(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @19 |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| external f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_hasImplicitReturnType_false() async { |
| var library = await buildLibrary(''' |
| class C { |
| int m() => 0; |
| } |
| '''); |
| var c = library.definingCompilationUnit.classes.single; |
| var m = c.methods.single; |
| expect(m.hasImplicitReturnType, isFalse); |
| } |
| |
| test_class_method_hasImplicitReturnType_true() async { |
| var library = await buildLibrary(''' |
| class C { |
| m() => 0; |
| } |
| '''); |
| var c = library.definingCompilationUnit.classes.single; |
| var m = c.methods.single; |
| expect(m.hasImplicitReturnType, isTrue); |
| } |
| |
| test_class_method_inferred_type_nonStatic_implicit_param() async { |
| var library = await buildLibrary( |
| 'class C extends D { void f(value) {} }' |
| ' abstract class D { void f(int value); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @25 |
| element: <testLibrary>::@class::C::@method::f |
| formalParameters |
| #F4 value @27 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::value |
| #F5 class D @54 |
| element: <testLibrary>::@class::D |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| methods |
| #F7 f @63 |
| element: <testLibrary>::@class::D::@method::f |
| formalParameters |
| #F8 value @69 |
| element: <testLibrary>::@class::D::@method::f::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional hasImplicitType value |
| firstFragment: #F4 |
| type: int |
| returnType: void |
| abstract class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| methods |
| abstract f |
| reference: <testLibrary>::@class::D::@method::f |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F8 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_inferred_type_nonStatic_implicit_return() async { |
| var library = await buildLibrary(''' |
| class C extends D { |
| f() => null; |
| } |
| abstract class D { |
| int f(); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @22 |
| element: <testLibrary>::@class::C::@method::f |
| #F4 class D @52 |
| element: <testLibrary>::@class::D |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| methods |
| #F6 f @62 |
| element: <testLibrary>::@class::D::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: int |
| abstract class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F5 |
| methods |
| abstract f |
| reference: <testLibrary>::@class::D::@method::f |
| firstFragment: #F6 |
| returnType: int |
| '''); |
| } |
| |
| test_class_method_invokesSuperSelf() async { |
| var library = await buildLibrary(r''' |
| class A { |
| void foo() { |
| super.foo(); |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 foo @17 invokesSuperSelf |
| element: <testLibrary>::@class::A::@method::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: #F3 |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_missingName() async { |
| var library = await buildLibrary(''' |
| class A { |
| () {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 <null-name> (offset=12) |
| element: <testLibrary>::@class::A::@method::0 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| <null-name> |
| reference: <testLibrary>::@class::A::@method::0 |
| firstFragment: #F3 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_namedAsSupertype() async { |
| var library = await buildLibrary(r''' |
| class A {} |
| class B extends A { |
| void A() {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @17 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| methods |
| #F5 A @38 |
| element: <testLibrary>::@class::B::@method::A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| methods |
| A |
| reference: <testLibrary>::@class::B::@method::A |
| firstFragment: #F5 |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_native() async { |
| var library = await buildLibrary(''' |
| class C { |
| int m() native; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 m @16 |
| element: <testLibrary>::@class::C::@method::m |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| external m |
| reference: <testLibrary>::@class::C::@method::m |
| firstFragment: #F3 |
| returnType: int |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_false_hide() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| void foo<T>(T _) {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| methods |
| #F3 foo @20 |
| element: <testLibrary>::@class::C::@method::foo |
| typeParameters |
| #F4 T @24 |
| element: #E1 T |
| formalParameters |
| #F5 _ @29 |
| element: <testLibrary>::@class::C::@method::foo::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| typeParameters |
| #E1 T |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F5 |
| type: T |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_formalParameter() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| void foo(T _) {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| methods |
| #F3 foo @20 |
| element: <testLibrary>::@class::C::@method::foo |
| formalParameters |
| #F4 _ @26 |
| element: <testLibrary>::@class::C::@method::foo::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F4 |
| type: T |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_formalParameter2() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| void foo(void Function(T) _) {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| methods |
| #F3 foo @20 |
| element: <testLibrary>::@class::C::@method::foo |
| formalParameters |
| #F4 _ @41 |
| element: <testLibrary>::@class::C::@method::foo::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F4 |
| type: void Function(T) |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_inferred() async { |
| var library = await buildLibrary(''' |
| class A<U> { |
| U foo() {} |
| } |
| |
| class B<T> extends A<T> { |
| foo() {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 U @8 |
| element: #E0 U |
| methods |
| #F3 foo @17 |
| element: <testLibrary>::@class::A::@method::foo |
| #F4 class B @35 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F5 T @37 |
| element: #E1 T |
| methods |
| #F6 foo @57 |
| element: <testLibrary>::@class::B::@method::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 U |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| returnType: U |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| supertype: A<T> |
| methods |
| foo |
| reference: <testLibrary>::@class::B::@method::foo |
| firstFragment: #F6 |
| hasEnclosingTypeParameterReference: true |
| returnType: T |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_returnType() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| T foo() {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| methods |
| #F3 foo @17 |
| element: <testLibrary>::@class::C::@method::foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| returnType: T |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_typeAlias() async { |
| var library = await buildLibrary(''' |
| typedef MyInt<U> = int; |
| |
| class C<T> { |
| MyInt<T> foo() {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @31 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @33 |
| element: #E0 T |
| methods |
| #F3 foo @49 |
| element: <testLibrary>::@class::C::@method::foo |
| typeAliases |
| #F4 MyInt @8 |
| element: <testLibrary>::@typeAlias::MyInt |
| typeParameters |
| #F5 U @14 |
| element: #E1 U |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| returnType: int |
| alias: <testLibrary>::@typeAlias::MyInt |
| typeArguments |
| T |
| typeAliases |
| MyInt |
| reference: <testLibrary>::@typeAlias::MyInt |
| firstFragment: #F4 |
| typeParameters |
| #E1 U |
| firstFragment: #F5 |
| aliasedType: int |
| '''); |
| } |
| |
| test_class_method_ofGeneric_refEnclosingTypeParameter_true_typeParameter() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| void foo<U extends T>() {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| methods |
| #F3 foo @20 |
| element: <testLibrary>::@class::C::@method::foo |
| typeParameters |
| #F4 U @24 |
| element: #E1 U |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| methods |
| foo |
| reference: <testLibrary>::@class::C::@method::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| typeParameters |
| #E1 U |
| firstFragment: #F4 |
| bound: T |
| returnType: void |
| '''); |
| } |
| |
| test_class_method_params() async { |
| var library = await buildLibrary('class C { f(x, y) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @10 |
| element: <testLibrary>::@class::C::@method::f |
| formalParameters |
| #F4 x @12 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::x |
| #F5 y @15 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::y |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional hasImplicitType x |
| firstFragment: #F4 |
| type: dynamic |
| requiredPositional hasImplicitType y |
| firstFragment: #F5 |
| type: dynamic |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_static() async { |
| var library = await buildLibrary('class C { static f() {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @17 |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| static f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_method_syncStar() async { |
| var library = await buildLibrary(r''' |
| class C { |
| Iterable<int> f() sync* { |
| yield 42; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @26 sync* |
| element: <testLibrary>::@class::C::@method::f |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: Iterable<int> |
| '''); |
| } |
| |
| test_class_method_type_parameter() async { |
| var library = await buildLibrary('class C { T f<T, U>(U u) => null; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @12 |
| element: <testLibrary>::@class::C::@method::f |
| typeParameters |
| #F4 T @14 |
| element: #E0 T |
| #F5 U @17 |
| element: #E1 U |
| formalParameters |
| #F6 u @22 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::u |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| typeParameters |
| #E0 T |
| firstFragment: #F4 |
| #E1 U |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional u |
| firstFragment: #F6 |
| type: U |
| returnType: T |
| '''); |
| } |
| |
| test_class_method_type_parameter_in_generic_class() async { |
| var library = await buildLibrary(''' |
| class C<T, U> { |
| V f<V, W>(T t, U u, W w) => null; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F5 f @20 |
| element: <testLibrary>::@class::C::@method::f |
| typeParameters |
| #F6 V @22 |
| element: #E2 V |
| #F7 W @25 |
| element: #E3 W |
| formalParameters |
| #F8 t @30 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::t |
| #F9 u @35 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::u |
| #F10 w @40 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::w |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F5 |
| hasEnclosingTypeParameterReference: true |
| typeParameters |
| #E2 V |
| firstFragment: #F6 |
| #E3 W |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F8 |
| type: T |
| requiredPositional u |
| firstFragment: #F9 |
| type: U |
| requiredPositional w |
| firstFragment: #F10 |
| type: W |
| returnType: V |
| '''); |
| } |
| |
| test_class_method_type_parameter_with_function_typed_parameter() async { |
| var library = await buildLibrary('class C { void f<T, U>(T x(U u)) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @15 |
| element: <testLibrary>::@class::C::@method::f |
| typeParameters |
| #F4 T @17 |
| element: #E0 T |
| #F5 U @20 |
| element: #E1 U |
| formalParameters |
| #F6 x @25 |
| element: <testLibrary>::@class::C::@method::f::@formalParameter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| typeParameters |
| #E0 T |
| firstFragment: #F4 |
| #E1 U |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F6 |
| type: T Function(U) |
| formalParameters |
| requiredPositional u |
| firstFragment: #F7 |
| type: U |
| returnType: void |
| '''); |
| } |
| |
| test_class_methods() async { |
| var library = await buildLibrary('class C { f() {} g() {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 f @10 |
| element: <testLibrary>::@class::C::@method::f |
| #F4 g @17 |
| element: <testLibrary>::@class::C::@method::g |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F3 |
| returnType: dynamic |
| g |
| reference: <testLibrary>::@class::C::@method::g |
| firstFragment: #F4 |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_missingName() async { |
| configuration.withExportScope = true; |
| var library = await buildLibrary(r''' |
| class {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class <null-name> (offset=6) |
| element: <testLibrary>::@class::0 |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::0::@constructor::new |
| typeName: null |
| classes |
| class <null-name> |
| reference: <testLibrary>::@class::0 |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::0::@constructor::new |
| firstFragment: #F2 |
| exportedReferences |
| exportNamespace |
| '''); |
| } |
| |
| test_class_mixin_class() async { |
| var library = await buildLibrary('mixin class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @12 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| mixin class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_mixins() async { |
| var library = await buildLibrary(''' |
| class C extends D with E, F, G {} |
| class D {} |
| class E {} |
| class F {} |
| class G {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @40 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @51 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| #F7 class F @62 |
| element: <testLibrary>::@class::F |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::F::@constructor::new |
| typeName: F |
| #F9 class G @73 |
| element: <testLibrary>::@class::G |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::G::@constructor::new |
| typeName: G |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| mixins |
| E |
| F |
| G |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| class F |
| reference: <testLibrary>::@class::F |
| firstFragment: #F7 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::F::@constructor::new |
| firstFragment: #F8 |
| class G |
| reference: <testLibrary>::@class::G |
| firstFragment: #F9 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::G::@constructor::new |
| firstFragment: #F10 |
| '''); |
| } |
| |
| test_class_mixins_extensionType() async { |
| var library = await buildLibrary(''' |
| mixin A {} |
| extension type B(int it) {} |
| mixin C {} |
| class D extends Object with A, B, C {} |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class D @56 |
| element: <testLibrary>::@class::D |
| extensionTypes |
| #F2 extension type B @26 |
| element: <testLibrary>::@extensionType::B |
| fields |
| #F3 it @32 |
| element: <testLibrary>::@extensionType::B::@field::it |
| getters |
| #F4 synthetic it |
| element: <testLibrary>::@extensionType::B::@getter::it |
| returnType: int |
| mixins |
| #F5 mixin A @6 |
| element: <testLibrary>::@mixin::A |
| #F6 mixin C @45 |
| element: <testLibrary>::@mixin::C |
| classes |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| A |
| C |
| extensionTypes |
| extension type B |
| reference: <testLibrary>::@extensionType::B |
| firstFragment: #F2 |
| representation: <testLibrary>::@extensionType::B::@field::it |
| primaryConstructor: <testLibrary>::@extensionType::B::@constructor::new |
| typeErasure: int |
| fields |
| final it |
| reference: <testLibrary>::@extensionType::B::@field::it |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@extensionType::B::@getter::it |
| getters |
| synthetic it |
| reference: <testLibrary>::@extensionType::B::@getter::it |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@extensionType::B::@field::it |
| mixins |
| mixin A |
| reference: <testLibrary>::@mixin::A |
| firstFragment: #F5 |
| superclassConstraints |
| Object |
| mixin C |
| reference: <testLibrary>::@mixin::C |
| firstFragment: #F6 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_class_mixins_generic() async { |
| var library = await buildLibrary(''' |
| class Z extends A with B<int>, C<double> {} |
| class A {} |
| class B<B1> {} |
| class C<C1> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class Z @6 |
| element: <testLibrary>::@class::Z |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::Z::@constructor::new |
| typeName: Z |
| #F3 class A @50 |
| element: <testLibrary>::@class::A |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F5 class B @61 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F6 B1 @63 |
| element: #E0 B1 |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| #F8 class C @76 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F9 C1 @78 |
| element: #E1 C1 |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class Z |
| reference: <testLibrary>::@class::Z |
| firstFragment: #F1 |
| supertype: A |
| mixins |
| B<int> |
| C<double> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::Z::@constructor::new |
| firstFragment: #F2 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F4 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| typeParameters |
| #E0 B1 |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F8 |
| typeParameters |
| #E1 C1 |
| firstFragment: #F9 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F10 |
| '''); |
| } |
| |
| test_class_mixins_generic_superAfter() async { |
| var library = await buildLibrary(''' |
| mixin M<T extends num> {} |
| mixin M2<T extends num> on M<T> {} |
| class Z extends S with M2 {} |
| class S with M<int> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class Z @67 |
| element: <testLibrary>::@class::Z |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::Z::@constructor::new |
| typeName: Z |
| #F3 class S @96 |
| element: <testLibrary>::@class::S |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::S::@constructor::new |
| typeName: S |
| mixins |
| #F5 mixin M @6 |
| element: <testLibrary>::@mixin::M |
| typeParameters |
| #F6 T @8 |
| element: #E0 T |
| #F7 mixin M2 @32 |
| element: <testLibrary>::@mixin::M2 |
| typeParameters |
| #F8 T @35 |
| element: #E1 T |
| classes |
| class Z |
| reference: <testLibrary>::@class::Z |
| firstFragment: #F1 |
| supertype: S |
| mixins |
| M2<int> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::Z::@constructor::new |
| firstFragment: #F2 |
| superConstructor: <testLibrary>::@class::S::@constructor::new |
| class S |
| reference: <testLibrary>::@class::S |
| firstFragment: #F3 |
| supertype: Object |
| mixins |
| M<int> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::S::@constructor::new |
| firstFragment: #F4 |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F5 |
| typeParameters |
| #E0 T |
| firstFragment: #F6 |
| bound: num |
| superclassConstraints |
| Object |
| mixin M2 |
| reference: <testLibrary>::@mixin::M2 |
| firstFragment: #F7 |
| typeParameters |
| #E1 T |
| firstFragment: #F8 |
| bound: num |
| superclassConstraints |
| M<T> |
| '''); |
| } |
| |
| test_class_mixins_genericMixin_tooManyArguments() async { |
| var library = await buildLibrary(''' |
| mixin M<T> {} |
| class A extends Object with M<int, String> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @20 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| mixins |
| #F3 mixin M @6 |
| element: <testLibrary>::@mixin::M |
| typeParameters |
| #F4 T @8 |
| element: #E0 T |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| typeParameters |
| #E0 T |
| firstFragment: #F4 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_class_mixins_typeParameter() async { |
| var library = await buildLibrary(''' |
| mixin M1 {} |
| mixin M2 {} |
| class A<T> extends Object with M1, T<int>, M2 {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @30 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @32 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| mixins |
| #F4 mixin M1 @6 |
| element: <testLibrary>::@mixin::M1 |
| #F5 mixin M2 @18 |
| element: <testLibrary>::@mixin::M2 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| supertype: Object |
| mixins |
| M1 |
| M2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| mixins |
| mixin M1 |
| reference: <testLibrary>::@mixin::M1 |
| firstFragment: #F4 |
| superclassConstraints |
| Object |
| mixin M2 |
| reference: <testLibrary>::@mixin::M2 |
| firstFragment: #F5 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_class_mixins_unresolved() async { |
| var library = await buildLibrary( |
| 'class C extends Object with X, Y, Z {} class X {} class Z {}', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class X @45 |
| element: <testLibrary>::@class::X |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::X::@constructor::new |
| typeName: X |
| #F5 class Z @56 |
| element: <testLibrary>::@class::Z |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::Z::@constructor::new |
| typeName: Z |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| X |
| Z |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| class X |
| reference: <testLibrary>::@class::X |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::X::@constructor::new |
| firstFragment: #F4 |
| class Z |
| reference: <testLibrary>::@class::Z |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::Z::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_circularity_via_typeAlias_recordType() async { |
| var library = await buildLibrary(''' |
| class C<T extends A> {} |
| typedef A = (C, int); |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeAliases |
| #F4 A @32 |
| element: <testLibrary>::@typeAlias::A |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| notSimplyBounded A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F4 |
| aliasedType: (C<dynamic>, int) |
| '''); |
| } |
| |
| test_class_notSimplyBounded_circularity_via_typedef() async { |
| // C's type parameter T is not simply bounded because its bound, F, expands |
| // to `dynamic F(C)`, which refers to C. |
| var library = await buildLibrary(''' |
| class C<T extends F> {} |
| typedef F(C value); |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeAliases |
| #F4 F @32 |
| element: <testLibrary>::@typeAlias::F |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| notSimplyBounded F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| aliasedType: dynamic Function(C<dynamic>) |
| '''); |
| } |
| |
| test_class_notSimplyBounded_circularity_with_type_params() async { |
| // C's type parameter T is simply bounded because even though it refers to |
| // C, it specifies a bound. |
| var library = await buildLibrary(''' |
| class C<T extends C<dynamic>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: C<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_complex_by_cycle_class() async { |
| var library = await buildLibrary(''' |
| class C<T extends D> {} |
| class D<T extends C> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @30 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F5 T @32 |
| element: #E1 T |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: D<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| notSimplyBounded class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| bound: C<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_complex_by_cycle_typedef_functionType() async { |
| var library = await buildLibrary(''' |
| typedef C<T extends D> = void Function(); |
| typedef D<T extends C> = void Function(); |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| typeAliases |
| #F1 C @8 |
| element: <testLibrary>::@typeAlias::C |
| typeParameters |
| #F2 T @10 |
| element: #E0 T |
| #F3 D @50 |
| element: <testLibrary>::@typeAlias::D |
| typeParameters |
| #F4 T @52 |
| element: #E1 T |
| typeAliases |
| notSimplyBounded C |
| reference: <testLibrary>::@typeAlias::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| aliasedType: void Function() |
| notSimplyBounded D |
| reference: <testLibrary>::@typeAlias::D |
| firstFragment: #F3 |
| typeParameters |
| #E1 T |
| firstFragment: #F4 |
| bound: dynamic |
| aliasedType: void Function() |
| '''); |
| } |
| |
| test_class_notSimplyBounded_complex_by_cycle_typedef_interfaceType() async { |
| var library = await buildLibrary(''' |
| typedef C<T extends D> = List<T>; |
| typedef D<T extends C> = List<T>; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| typeAliases |
| #F1 C @8 |
| element: <testLibrary>::@typeAlias::C |
| typeParameters |
| #F2 T @10 |
| element: #E0 T |
| #F3 D @42 |
| element: <testLibrary>::@typeAlias::D |
| typeParameters |
| #F4 T @44 |
| element: #E1 T |
| typeAliases |
| notSimplyBounded C |
| reference: <testLibrary>::@typeAlias::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| aliasedType: List<T> |
| notSimplyBounded D |
| reference: <testLibrary>::@typeAlias::D |
| firstFragment: #F3 |
| typeParameters |
| #E1 T |
| firstFragment: #F4 |
| bound: dynamic |
| aliasedType: List<T> |
| '''); |
| } |
| |
| test_class_notSimplyBounded_complex_by_reference_to_cycle() async { |
| var library = await buildLibrary(''' |
| class C<T extends D> {} |
| class D<T extends D> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @30 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F5 T @32 |
| element: #E1 T |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: D<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| notSimplyBounded class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| bound: D<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_complex_by_use_of_parameter() async { |
| var library = await buildLibrary(''' |
| class C<T extends D<T>> {} |
| class D<T> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @33 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F5 T @35 |
| element: #E1 T |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: D<T> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_dependency_with_type_params() async { |
| // C's type parameter T is simply bounded because even though it refers to |
| // non-simply-bounded type D, it specifies a bound. |
| var library = await buildLibrary(''' |
| class C<T extends D<dynamic>> {} |
| class D<T extends D<T>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @39 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F5 T @41 |
| element: #E1 T |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: D<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| notSimplyBounded class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| bound: D<T> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_function_typed_bound_complex_via_parameter_type() async { |
| var library = await buildLibrary(''' |
| class C<T extends void Function(T)> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: void Function(T) |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_function_typed_bound_complex_via_return_type() async { |
| var library = await buildLibrary(''' |
| class C<T extends T Function()> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: T Function() |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_function_typed_bound_simple() async { |
| var library = await buildLibrary(''' |
| class C<T extends void Function()> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: void Function() |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_refers_to_circular_typedef() async { |
| // C's type parameter T has a bound of F, which is a circular typedef. This |
| // is illegal in Dart, but we need to make sure it doesn't lead to a crash |
| // or infinite loop. |
| var library = await buildLibrary(''' |
| class C<T extends F> {} |
| typedef F(G value); |
| typedef G(F value); |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| typeAliases |
| #F4 F @32 |
| element: <testLibrary>::@typeAlias::F |
| #F5 G @52 |
| element: <testLibrary>::@typeAlias::G |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| notSimplyBounded F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| aliasedType: dynamic Function(dynamic) |
| notSimplyBounded G |
| reference: <testLibrary>::@typeAlias::G |
| firstFragment: #F5 |
| aliasedType: dynamic Function(dynamic) |
| '''); |
| } |
| |
| test_class_notSimplyBounded_self() async { |
| var library = await buildLibrary(''' |
| class C<T extends C> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: C<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_simple_because_non_generic() async { |
| // If no type parameters are specified, then the class is simply bounded, so |
| // there is no reason to assign it a slot. |
| var library = await buildLibrary(''' |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_simple_by_lack_of_cycles() async { |
| var library = await buildLibrary(''' |
| class C<T extends D> {} |
| class D<T> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @30 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F5 T @32 |
| element: #E1 T |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: D<dynamic> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| typeParameters |
| #E1 T |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_notSimplyBounded_simple_by_syntax() async { |
| // If no bounds are specified, then the class is simply bounded by syntax |
| // alone, so there is no reason to assign it a slot. |
| var library = await buildLibrary(''' |
| class C<T> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_operator() async { |
| var library = await buildLibrary( |
| 'class C { C operator+(C other) => null; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 + @20 |
| element: <testLibrary>::@class::C::@method::+ |
| formalParameters |
| #F4 other @24 |
| element: <testLibrary>::@class::C::@method::+::@formalParameter::other |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| + |
| reference: <testLibrary>::@class::C::@method::+ |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: C |
| returnType: C |
| '''); |
| } |
| |
| test_class_operator_equal() async { |
| var library = await buildLibrary(''' |
| class C { |
| bool operator==(Object other) => false; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 == @25 |
| element: <testLibrary>::@class::C::@method::== |
| formalParameters |
| #F4 other @35 |
| element: <testLibrary>::@class::C::@method::==::@formalParameter::other |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| == |
| reference: <testLibrary>::@class::C::@method::== |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: Object |
| returnType: bool |
| '''); |
| } |
| |
| test_class_operator_external() async { |
| var library = await buildLibrary( |
| 'class C { external C operator+(C other); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 + @29 |
| element: <testLibrary>::@class::C::@method::+ |
| formalParameters |
| #F4 other @33 |
| element: <testLibrary>::@class::C::@method::+::@formalParameter::other |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| external + |
| reference: <testLibrary>::@class::C::@method::+ |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: C |
| returnType: C |
| '''); |
| } |
| |
| test_class_operator_greater_equal() async { |
| var library = await buildLibrary(''' |
| class C { |
| bool operator>=(C other) => false; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 >= @25 |
| element: <testLibrary>::@class::C::@method::>= |
| formalParameters |
| #F4 other @30 |
| element: <testLibrary>::@class::C::@method::>=::@formalParameter::other |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| >= |
| reference: <testLibrary>::@class::C::@method::>= |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: C |
| returnType: bool |
| '''); |
| } |
| |
| test_class_operator_index() async { |
| var library = await buildLibrary( |
| 'class C { bool operator[](int i) => null; }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 [] @23 |
| element: <testLibrary>::@class::C::@method::[] |
| formalParameters |
| #F4 i @30 |
| element: <testLibrary>::@class::C::@method::[]::@formalParameter::i |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| [] |
| reference: <testLibrary>::@class::C::@method::[] |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F4 |
| type: int |
| returnType: bool |
| '''); |
| } |
| |
| test_class_operator_index_set() async { |
| var library = await buildLibrary(''' |
| class C { |
| void operator[]=(int i, bool v) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 []= @25 |
| element: <testLibrary>::@class::C::@method::[]= |
| formalParameters |
| #F4 i @33 |
| element: <testLibrary>::@class::C::@method::[]=::@formalParameter::i |
| #F5 v @41 |
| element: <testLibrary>::@class::C::@method::[]=::@formalParameter::v |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| []= |
| reference: <testLibrary>::@class::C::@method::[]= |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F4 |
| type: int |
| requiredPositional v |
| firstFragment: #F5 |
| type: bool |
| returnType: void |
| '''); |
| } |
| |
| test_class_operator_less_equal() async { |
| var library = await buildLibrary(''' |
| class C { |
| bool operator<=(C other) => false; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F3 <= @25 |
| element: <testLibrary>::@class::C::@method::<= |
| formalParameters |
| #F4 other @30 |
| element: <testLibrary>::@class::C::@method::<=::@formalParameter::other |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| methods |
| <= |
| reference: <testLibrary>::@class::C::@method::<= |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: C |
| returnType: bool |
| '''); |
| } |
| |
| test_class_operator_minus() async { |
| var library = await buildLibrary(''' |
| class A { |
| int operator -(int other) => 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 - @25 |
| element: <testLibrary>::@class::A::@method::- |
| formalParameters |
| #F4 other @31 |
| element: <testLibrary>::@class::A::@method::-::@formalParameter::other |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| - |
| reference: <testLibrary>::@class::A::@method::- |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional other |
| firstFragment: #F4 |
| type: int |
| returnType: int |
| '''); |
| } |
| |
| test_class_operator_minus_unary() async { |
| var library = await buildLibrary(''' |
| class A { |
| int operator -() => 0; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 - @25 |
| element: <testLibrary>::@class::A::@method::unary- |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| - |
| reference: <testLibrary>::@class::A::@method::unary- |
| firstFragment: #F3 |
| returnType: int |
| '''); |
| } |
| |
| test_class_ref_nullability_none() async { |
| var library = await buildLibrary(''' |
| class C {} |
| C c; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| topLevelVariables |
| #F3 c @13 |
| element: <testLibrary>::@topLevelVariable::c |
| getters |
| #F4 synthetic c |
| element: <testLibrary>::@getter::c |
| returnType: C |
| setters |
| #F5 synthetic c |
| element: <testLibrary>::@setter::c |
| formalParameters |
| #F6 _c |
| element: <testLibrary>::@setter::c::@formalParameter::_c |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| topLevelVariables |
| c |
| reference: <testLibrary>::@topLevelVariable::c |
| firstFragment: #F3 |
| type: C |
| getter: <testLibrary>::@getter::c |
| setter: <testLibrary>::@setter::c |
| getters |
| synthetic static c |
| reference: <testLibrary>::@getter::c |
| firstFragment: #F4 |
| returnType: C |
| variable: <testLibrary>::@topLevelVariable::c |
| setters |
| synthetic static c |
| reference: <testLibrary>::@setter::c |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _c |
| firstFragment: #F6 |
| type: C |
| returnType: void |
| '''); |
| } |
| |
| test_class_ref_nullability_question() async { |
| var library = await buildLibrary(''' |
| class C {} |
| C? c; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| topLevelVariables |
| #F3 c @14 |
| element: <testLibrary>::@topLevelVariable::c |
| getters |
| #F4 synthetic c |
| element: <testLibrary>::@getter::c |
| returnType: C? |
| setters |
| #F5 synthetic c |
| element: <testLibrary>::@setter::c |
| formalParameters |
| #F6 _c |
| element: <testLibrary>::@setter::c::@formalParameter::_c |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| topLevelVariables |
| c |
| reference: <testLibrary>::@topLevelVariable::c |
| firstFragment: #F3 |
| type: C? |
| getter: <testLibrary>::@getter::c |
| setter: <testLibrary>::@setter::c |
| getters |
| synthetic static c |
| reference: <testLibrary>::@getter::c |
| firstFragment: #F4 |
| returnType: C? |
| variable: <testLibrary>::@topLevelVariable::c |
| setters |
| synthetic static c |
| reference: <testLibrary>::@setter::c |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _c |
| firstFragment: #F6 |
| type: C? |
| returnType: void |
| '''); |
| } |
| |
| test_class_sealed() async { |
| var library = await buildLibrary('sealed class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @13 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| abstract sealed class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_sealed_induced_base_extends_base() async { |
| var library = await buildLibrary(''' |
| base class A {} |
| sealed class B extends A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @11 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @29 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| base class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed base class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_sealed_induced_base_implements_base() async { |
| var library = await buildLibrary(''' |
| base class A {} |
| sealed class B implements A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @11 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @29 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| base class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed base class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| interfaces |
| A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_sealed_induced_base_implements_final() async { |
| var library = await buildLibrary(''' |
| final class A {} |
| sealed class B implements A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @12 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @30 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| final class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed base class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| interfaces |
| A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_sealed_induced_final_extends_final() async { |
| var library = await buildLibrary(''' |
| final class A {} |
| sealed class B extends A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @12 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @30 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| final class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed final class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_sealed_induced_final_with_base_mixin() async { |
| var library = await buildLibrary(''' |
| base mixin A {} |
| interface class B {} |
| sealed class C extends B with A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @32 |
| element: <testLibrary>::@class::B |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| #F3 class C @50 |
| element: <testLibrary>::@class::C |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F5 mixin A @11 |
| element: <testLibrary>::@mixin::A |
| classes |
| interface class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F2 |
| abstract sealed final class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F3 |
| supertype: B |
| mixins |
| A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::B::@constructor::new |
| mixins |
| base mixin A |
| reference: <testLibrary>::@mixin::A |
| firstFragment: #F5 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_class_sealed_induced_interface_extends_interface() async { |
| var library = await buildLibrary(''' |
| interface class A {} |
| sealed class B extends A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @16 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @34 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| interface class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed interface class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_class_sealed_induced_none_implements_interface() async { |
| var library = await buildLibrary(''' |
| interface class A {} |
| sealed class B implements A {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @16 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class B @34 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| interface class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| abstract sealed class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| interfaces |
| A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_setter_abstract() async { |
| var library = await buildLibrary( |
| 'abstract class C { void set x(int value); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @28 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @34 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| abstract class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| abstract x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_covariant() async { |
| var library = await buildLibrary( |
| 'class C { void set x(covariant int value); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @35 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| abstract x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional covariant value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_external() async { |
| var library = await buildLibrary( |
| 'class C { external void set x(int value); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @28 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @34 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| external x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_implicit_param_type() async { |
| var library = await buildLibrary('class C { void set x(value) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @21 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional hasImplicitType value |
| firstFragment: #F5 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_implicit_return_type() async { |
| var library = await buildLibrary('class C { set x(int value) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @14 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @20 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_inferred_type_conflictingInheritance() async { |
| var library = await buildLibrary(''' |
| class A { |
| int t; |
| } |
| class B extends A { |
| double t; |
| } |
| class C extends A implements B { |
| } |
| class D extends C { |
| void set t(p) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 t @16 |
| element: <testLibrary>::@class::A::@field::t |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| getters |
| #F4 synthetic t |
| element: <testLibrary>::@class::A::@getter::t |
| returnType: int |
| setters |
| #F5 synthetic t |
| element: <testLibrary>::@class::A::@setter::t |
| formalParameters |
| #F6 _t |
| element: <testLibrary>::@class::A::@setter::t::@formalParameter::_t |
| #F7 class B @27 |
| element: <testLibrary>::@class::B |
| fields |
| #F8 t @50 |
| element: <testLibrary>::@class::B::@field::t |
| constructors |
| #F9 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| getters |
| #F10 synthetic t |
| element: <testLibrary>::@class::B::@getter::t |
| returnType: double |
| setters |
| #F11 synthetic t |
| element: <testLibrary>::@class::B::@setter::t |
| formalParameters |
| #F12 _t |
| element: <testLibrary>::@class::B::@setter::t::@formalParameter::_t |
| #F13 class C @61 |
| element: <testLibrary>::@class::C |
| constructors |
| #F14 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F15 class D @96 |
| element: <testLibrary>::@class::D |
| fields |
| #F16 synthetic t |
| element: <testLibrary>::@class::D::@field::t |
| constructors |
| #F17 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| setters |
| #F18 t @121 |
| element: <testLibrary>::@class::D::@setter::t |
| formalParameters |
| #F19 p @123 |
| element: <testLibrary>::@class::D::@setter::t::@formalParameter::p |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| t |
| reference: <testLibrary>::@class::A::@field::t |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::A::@getter::t |
| setter: <testLibrary>::@class::A::@setter::t |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| getters |
| synthetic t |
| reference: <testLibrary>::@class::A::@getter::t |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@class::A::@field::t |
| setters |
| synthetic t |
| reference: <testLibrary>::@class::A::@setter::t |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional _t |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F7 |
| supertype: A |
| fields |
| t |
| reference: <testLibrary>::@class::B::@field::t |
| firstFragment: #F8 |
| type: double |
| getter: <testLibrary>::@class::B::@getter::t |
| setter: <testLibrary>::@class::B::@setter::t |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F9 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| getters |
| synthetic t |
| reference: <testLibrary>::@class::B::@getter::t |
| firstFragment: #F10 |
| returnType: double |
| variable: <testLibrary>::@class::B::@field::t |
| setters |
| synthetic t |
| reference: <testLibrary>::@class::B::@setter::t |
| firstFragment: #F11 |
| formalParameters |
| requiredPositional _t |
| firstFragment: #F12 |
| type: double |
| returnType: void |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F13 |
| supertype: A |
| interfaces |
| B |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F14 |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F15 |
| supertype: C |
| fields |
| synthetic t |
| reference: <testLibrary>::@class::D::@field::t |
| firstFragment: #F16 |
| type: dynamic |
| setter: <testLibrary>::@class::D::@setter::t |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F17 |
| superConstructor: <testLibrary>::@class::C::@constructor::new |
| setters |
| t |
| reference: <testLibrary>::@class::D::@setter::t |
| firstFragment: #F18 |
| formalParameters |
| requiredPositional hasImplicitType p |
| firstFragment: #F19 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_inferred_type_nonStatic_implicit_param() async { |
| var library = await buildLibrary( |
| 'class C extends D { void set f(value) {} }' |
| ' abstract class D { void set f(int value); }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic f |
| element: <testLibrary>::@class::C::@field::f |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 f @29 |
| element: <testLibrary>::@class::C::@setter::f |
| formalParameters |
| #F5 value @31 |
| element: <testLibrary>::@class::C::@setter::f::@formalParameter::value |
| #F6 class D @58 |
| element: <testLibrary>::@class::D |
| fields |
| #F7 synthetic f |
| element: <testLibrary>::@class::D::@field::f |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| setters |
| #F9 f @71 |
| element: <testLibrary>::@class::D::@setter::f |
| formalParameters |
| #F10 value @77 |
| element: <testLibrary>::@class::D::@setter::f::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| fields |
| synthetic f |
| reference: <testLibrary>::@class::C::@field::f |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::f |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| setters |
| f |
| reference: <testLibrary>::@class::C::@setter::f |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional hasImplicitType value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| abstract class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F6 |
| fields |
| synthetic f |
| reference: <testLibrary>::@class::D::@field::f |
| firstFragment: #F7 |
| type: int |
| setter: <testLibrary>::@class::D::@setter::f |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F8 |
| setters |
| abstract f |
| reference: <testLibrary>::@class::D::@setter::f |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F10 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_inferred_type_static_implicit_return() async { |
| var library = await buildLibrary(''' |
| class C { |
| static set f(int value) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic f |
| element: <testLibrary>::@class::C::@field::f |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 f @23 |
| element: <testLibrary>::@class::C::@setter::f |
| formalParameters |
| #F5 value @29 |
| element: <testLibrary>::@class::C::@setter::f::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic static f |
| reference: <testLibrary>::@class::C::@field::f |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::f |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| static f |
| reference: <testLibrary>::@class::C::@setter::f |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invalid_named_parameter() async { |
| var library = await buildLibrary('class C { void set x({a}) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 a @22 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::a |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| optionalNamed hasImplicitType a |
| firstFragment: #F5 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invalid_no_parameter() async { |
| var library = await buildLibrary('class C { void set x() {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invalid_optional_parameter() async { |
| var library = await buildLibrary('class C { void set x([a]) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 a @22 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::a |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| optionalPositional hasImplicitType a |
| firstFragment: #F5 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invalid_too_many_parameters() async { |
| var library = await buildLibrary('class C { void set x(a, b) {} }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @19 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 a @21 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::a |
| #F6 b @24 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::b |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional hasImplicitType a |
| firstFragment: #F5 |
| type: dynamic |
| requiredPositional hasImplicitType b |
| firstFragment: #F6 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invokesSuperSelf_getter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| set foo(int _) { |
| super.foo; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| setters |
| #F4 foo @16 |
| element: <testLibrary>::@class::A::@setter::foo |
| formalParameters |
| #F5 _ @24 |
| element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_ |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| setters |
| foo |
| reference: <testLibrary>::@class::A::@setter::foo |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_invokesSuperSelf_setter() async { |
| var library = await buildLibrary(r''' |
| class A { |
| set foo(int _) { |
| super.foo = 0; |
| } |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| fields |
| #F2 synthetic foo |
| element: <testLibrary>::@class::A::@field::foo |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| setters |
| #F4 foo @16 |
| element: <testLibrary>::@class::A::@setter::foo |
| formalParameters |
| #F5 _ @24 |
| element: <testLibrary>::@class::A::@setter::foo::@formalParameter::_ |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::A::@field::foo |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| setters |
| foo |
| reference: <testLibrary>::@class::A::@setter::foo |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_missingName() async { |
| var library = await buildLibrary(''' |
| class A { |
| set (int _) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| methods |
| #F3 set @12 |
| element: <testLibrary>::@class::A::@method::set |
| formalParameters |
| #F4 _ @21 |
| element: <testLibrary>::@class::A::@method::set::@formalParameter::_ |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| methods |
| set |
| reference: <testLibrary>::@class::A::@method::set |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F4 |
| type: int |
| returnType: dynamic |
| '''); |
| } |
| |
| test_class_setter_native() async { |
| var library = await buildLibrary(''' |
| class C { |
| void set x(int value) native; |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @21 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @27 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| external x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_ofGeneric_refEnclosingTypeParameter_false() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| set foo(int _) {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo |
| setters |
| #F4 foo @19 |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F5 _ @27 |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::foo |
| setters |
| foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_ofGeneric_refEnclosingTypeParameter_true() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| set foo(T _) {} |
| } |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| fields |
| #F3 synthetic foo |
| element: <testLibrary>::@class::C::@field::foo |
| setters |
| #F4 foo @19 |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F5 _ @25 |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_ |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| fields |
| synthetic foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F3 |
| hasEnclosingTypeParameterReference: true |
| type: T |
| setter: <testLibrary>::@class::C::@setter::foo |
| setters |
| foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F4 |
| hasEnclosingTypeParameterReference: true |
| formalParameters |
| requiredPositional _ |
| firstFragment: #F5 |
| type: T |
| returnType: void |
| '''); |
| } |
| |
| test_class_setter_static() async { |
| var library = await buildLibrary( |
| 'class C { static void set x(int value) {} }', |
| ); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @26 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 value @32 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic static x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| static x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F5 |
| type: int |
| returnType: void |
| '''); |
| } |
| |
| test_class_setters() async { |
| var library = await buildLibrary(''' |
| class C { |
| void set x(int value) {} |
| set y(value) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| #F3 synthetic y |
| element: <testLibrary>::@class::C::@field::y |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F5 x @21 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F6 value @27 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::value |
| #F7 y @43 |
| element: <testLibrary>::@class::C::@setter::y |
| formalParameters |
| #F8 value @45 |
| element: <testLibrary>::@class::C::@setter::y::@formalParameter::value |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: int |
| setter: <testLibrary>::@class::C::@setter::x |
| synthetic y |
| reference: <testLibrary>::@class::C::@field::y |
| firstFragment: #F3 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::y |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F5 |
| formalParameters |
| requiredPositional value |
| firstFragment: #F6 |
| type: int |
| returnType: void |
| y |
| reference: <testLibrary>::@class::C::@setter::y |
| firstFragment: #F7 |
| formalParameters |
| requiredPositional hasImplicitType value |
| firstFragment: #F8 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_class_supertype() async { |
| var library = await buildLibrary(''' |
| class A {} |
| class B extends A {} |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| #F2 class B @17 |
| element: <testLibrary>::@class::B |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F2 |
| supertype: A |
| '''); |
| } |
| |
| test_class_supertype_dynamic() async { |
| var library = await buildLibrary(''' |
| class A extends dynamic {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_supertype_extensionType() async { |
| var library = await buildLibrary(''' |
| extension type A(int it) {} |
| class B extends A {} |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @34 |
| element: <testLibrary>::@class::B |
| extensionTypes |
| #F2 extension type A @15 |
| element: <testLibrary>::@extensionType::A |
| fields |
| #F3 it @21 |
| element: <testLibrary>::@extensionType::A::@field::it |
| getters |
| #F4 synthetic it |
| element: <testLibrary>::@extensionType::A::@getter::it |
| returnType: int |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| extensionTypes |
| extension type A |
| reference: <testLibrary>::@extensionType::A |
| firstFragment: #F2 |
| representation: <testLibrary>::@extensionType::A::@field::it |
| primaryConstructor: <testLibrary>::@extensionType::A::@constructor::new |
| typeErasure: int |
| fields |
| final it |
| reference: <testLibrary>::@extensionType::A::@field::it |
| firstFragment: #F3 |
| type: int |
| getter: <testLibrary>::@extensionType::A::@getter::it |
| getters |
| synthetic it |
| reference: <testLibrary>::@extensionType::A::@getter::it |
| firstFragment: #F4 |
| returnType: int |
| variable: <testLibrary>::@extensionType::A::@field::it |
| '''); |
| } |
| |
| test_class_supertype_genericClass() async { |
| var library = await buildLibrary(''' |
| class C extends D<int, double> {} |
| class D<T1, T2> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @40 |
| element: <testLibrary>::@class::D |
| typeParameters |
| #F4 T1 @42 |
| element: #E0 T1 |
| #F5 T2 @46 |
| element: #E1 T2 |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D<int, double> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::D::@constructor::new |
| substitution: {T1: int, T2: double} |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| typeParameters |
| #E0 T1 |
| firstFragment: #F4 |
| #E1 T2 |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_supertype_genericClass_tooManyArguments() async { |
| var library = await buildLibrary(''' |
| class A<T> {} |
| class B extends A<int, String> {} |
| '''); |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 class B @20 |
| element: <testLibrary>::@class::B |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A<dynamic> |
| '''); |
| } |
| |
| test_class_supertype_typeArguments_self() async { |
| var library = await buildLibrary(''' |
| class A<T> {} |
| class B extends A<B> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F4 class B @20 |
| element: <testLibrary>::@class::B |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F4 |
| supertype: A<B> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F5 |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: B} |
| '''); |
| } |
| |
| test_class_supertype_typeParameter() async { |
| var library = await buildLibrary(''' |
| class A<T> extends T<int> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_supertype_unresolved() async { |
| var library = await buildLibrary('class C extends D {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| '''); |
| } |
| |
| test_class_typeParameters() async { |
| var library = await buildLibrary('class C<T, U> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @11 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_typeParameters_bound() async { |
| var library = await buildLibrary(''' |
| class C<T extends Object, U extends D> {} |
| class D {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @26 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F5 class D @48 |
| element: <testLibrary>::@class::D |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: Object |
| #E1 U |
| firstFragment: #F3 |
| bound: D |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_class_typeParameters_cycle_1of1() async { |
| var library = await buildLibrary('class C<T extends T> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_cycle_2of3() async { |
| var library = await buildLibrary(r''' |
| class C<T extends V, U, V extends T> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @21 |
| element: #E1 U |
| #F4 V @24 |
| element: #E2 V |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: dynamic |
| #E1 U |
| firstFragment: #F3 |
| #E2 V |
| firstFragment: #F4 |
| bound: dynamic |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_cycle_genericFunctionType() async { |
| var library = await buildLibrary(r''' |
| class A<T extends void Function(A)> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: void Function(A<dynamic>) |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_cycle_genericFunctionType2() async { |
| var library = await buildLibrary(r''' |
| class C<T extends void Function<U extends C>()> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: void Function<U extends C<dynamic>>() |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_functionTypeAlias_contravariant() async { |
| var library = await buildLibrary(r''' |
| typedef F<X> = void Function(X); |
| |
| class A<X extends F<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @40 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @42 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeAliases |
| #F4 F @8 |
| element: <testLibrary>::@typeAlias::F |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: void Function(X) |
| alias: <testLibrary>::@typeAlias::F |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: void Function(X) |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_functionTypeAlias_covariant() async { |
| var library = await buildLibrary(r''' |
| typedef F<X> = X Function(); |
| |
| class A<X extends F<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @36 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @38 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeAliases |
| #F4 F @8 |
| element: <testLibrary>::@typeAlias::F |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function() |
| alias: <testLibrary>::@typeAlias::F |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: X Function() |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_functionTypeAlias_invariant() async { |
| var library = await buildLibrary(r''' |
| typedef F<X> = X Function(X); |
| |
| class A<X extends F<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @37 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @39 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeAliases |
| #F4 F @8 |
| element: <testLibrary>::@typeAlias::F |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function(X) |
| alias: <testLibrary>::@typeAlias::F |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: X Function(X) |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_functionTypeAlias_invariant_legacy() async { |
| var library = await buildLibrary(r''' |
| typedef F<X> = X Function(X); |
| |
| class A<X extends F<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @37 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @39 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeAliases |
| #F4 F @8 |
| element: <testLibrary>::@typeAlias::F |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function(X) |
| alias: <testLibrary>::@typeAlias::F |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| F |
| reference: <testLibrary>::@typeAlias::F |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: X Function(X) |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_genericFunctionType_both() async { |
| var library = await buildLibrary(r''' |
| class A<X extends X Function(X)> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @8 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function(X) |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_genericFunctionType_contravariant() async { |
| var library = await buildLibrary(r''' |
| class A<X extends void Function(X)> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @8 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: void Function(X) |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_genericFunctionType_covariant() async { |
| var library = await buildLibrary(r''' |
| class A<X extends X Function()> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @8 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function() |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_genericFunctionType_covariant_legacy() async { |
| var library = await buildLibrary(r''' |
| class A<X extends X Function()> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 X @8 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: X Function() |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_typeAlias_interface_contravariant() async { |
| var library = await buildLibrary(r''' |
| typedef A<X> = List<void Function(X)>; |
| |
| class B<X extends A<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @46 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F2 X @48 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeAliases |
| #F4 A @8 |
| element: <testLibrary>::@typeAlias::A |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: List<void Function(X)> |
| alias: <testLibrary>::@typeAlias::A |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: List<void Function(X)> |
| '''); |
| } |
| |
| test_class_typeParameters_defaultType_typeAlias_interface_covariant() async { |
| var library = await buildLibrary(r''' |
| typedef A<X> = Map<X, int>; |
| |
| class B<X extends A<X>> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class B @35 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F2 X @37 |
| element: #E0 X |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| typeAliases |
| #F4 A @8 |
| element: <testLibrary>::@typeAlias::A |
| typeParameters |
| #F5 X @10 |
| element: #E1 X |
| classes |
| notSimplyBounded class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F1 |
| typeParameters |
| #E0 X |
| firstFragment: #F2 |
| bound: Map<X, int> |
| alias: <testLibrary>::@typeAlias::A |
| typeArguments |
| X |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F3 |
| typeAliases |
| A |
| reference: <testLibrary>::@typeAlias::A |
| firstFragment: #F4 |
| typeParameters |
| #E1 X |
| firstFragment: #F5 |
| aliasedType: Map<X, int> |
| '''); |
| } |
| |
| test_class_typeParameters_f_bound_complex() async { |
| var library = await buildLibrary('class C<T extends List<U>, U> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @27 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: List<U> |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_typeParameters_f_bound_simple() async { |
| var library = await buildLibrary('class C<T extends U, U> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 U @21 |
| element: #E1 U |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| notSimplyBounded class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: U |
| #E1 U |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_typeParameters_missingName() async { |
| var library = await buildLibrary(r''' |
| class A<T,> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| #F3 <null-name> (offset=10) |
| element: #E1 <null-name> |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 <null-name> |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_class_typeParameters_variance_contravariant() async { |
| var library = await buildLibrary('class C<in T> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @11 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_variance_covariant() async { |
| var library = await buildLibrary('class C<out T> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @12 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_variance_invariant() async { |
| var library = await buildLibrary('class C<inout T> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @14 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| '''); |
| } |
| |
| test_class_typeParameters_variance_multiple() async { |
| var library = await buildLibrary('class C<inout T, in U, out V> {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @14 |
| element: #E0 T |
| #F3 U @20 |
| element: #E1 U |
| #F4 V @27 |
| element: #E2 V |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| #E1 U |
| firstFragment: #F3 |
| #E2 V |
| firstFragment: #F4 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F5 |
| '''); |
| } |
| |
| test_classAlias() async { |
| var library = await buildLibrary(''' |
| class C = D with E, F, G; |
| class D {} |
| class E {} |
| class F {} |
| class G {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @32 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @43 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| #F7 class F @54 |
| element: <testLibrary>::@class::F |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::F::@constructor::new |
| typeName: F |
| #F9 class G @65 |
| element: <testLibrary>::@class::G |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::G::@constructor::new |
| typeName: G |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| mixins |
| E |
| F |
| G |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| class F |
| reference: <testLibrary>::@class::F |
| firstFragment: #F7 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::F::@constructor::new |
| firstFragment: #F8 |
| class G |
| reference: <testLibrary>::@class::G |
| firstFragment: #F9 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::G::@constructor::new |
| firstFragment: #F10 |
| '''); |
| } |
| |
| test_classAlias_abstract() async { |
| var library = await buildLibrary(''' |
| abstract class C = D with E; |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @15 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @35 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @46 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| abstract class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_classAlias_base() async { |
| var library = await buildLibrary(''' |
| base class C = Object with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @11 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F3 mixin M @36 |
| element: <testLibrary>::@mixin::M |
| classes |
| base class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_constructors_beforeOtherProperties() async { |
| // https://github.com/dart-lang/sdk/issues/57035 |
| var library = await buildLibrary(''' |
| abstract mixin class A {} |
| mixin M {} |
| class X = A with M; |
| '''); |
| |
| var X = library.getClass2('X')!; |
| expect(X.constructors, hasLength(1)); |
| } |
| |
| test_classAlias_constructors_chain_backward() async { |
| var library = await buildLibrary(''' |
| class A { |
| A.named(); |
| } |
| class C = B with M; |
| class B = A with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 named @14 |
| element: <testLibrary>::@class::A::@constructor::named |
| typeName: A |
| typeNameOffset: 12 |
| periodOffset: 13 |
| #F3 class C @31 |
| element: <testLibrary>::@class::C |
| constructors |
| #F4 synthetic named |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| #F5 class B @51 |
| element: <testLibrary>::@class::B |
| constructors |
| #F6 synthetic named |
| element: <testLibrary>::@class::B::@constructor::named |
| typeName: B |
| mixins |
| #F7 mixin M @71 |
| element: <testLibrary>::@mixin::M |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| named |
| reference: <testLibrary>::@class::A::@constructor::named |
| firstFragment: #F2 |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F3 |
| supertype: B |
| mixins |
| M |
| constructors |
| synthetic named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F4 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| element: <testLibrary>::@class::B::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::B::@constructor::named |
| superConstructor: <testLibrary>::@class::B::@constructor::named |
| class alias B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| supertype: A |
| mixins |
| M |
| constructors |
| synthetic named |
| reference: <testLibrary>::@class::B::@constructor::named |
| firstFragment: #F6 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| element: <testLibrary>::@class::A::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::named |
| superConstructor: <testLibrary>::@class::A::@constructor::named |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F7 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_constructors_chain_forward() async { |
| var library = await buildLibrary(''' |
| class A { |
| A.named(); |
| } |
| class B = A with M; |
| class C = B with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 named @14 |
| element: <testLibrary>::@class::A::@constructor::named |
| typeName: A |
| typeNameOffset: 12 |
| periodOffset: 13 |
| #F3 class B @31 |
| element: <testLibrary>::@class::B |
| constructors |
| #F4 synthetic named |
| element: <testLibrary>::@class::B::@constructor::named |
| typeName: B |
| #F5 class C @51 |
| element: <testLibrary>::@class::C |
| constructors |
| #F6 synthetic named |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| mixins |
| #F7 mixin M @71 |
| element: <testLibrary>::@mixin::M |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| named |
| reference: <testLibrary>::@class::A::@constructor::named |
| firstFragment: #F2 |
| class alias B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F3 |
| supertype: A |
| mixins |
| M |
| constructors |
| synthetic named |
| reference: <testLibrary>::@class::B::@constructor::named |
| firstFragment: #F4 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| element: <testLibrary>::@class::A::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::named |
| superConstructor: <testLibrary>::@class::A::@constructor::named |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F5 |
| supertype: B |
| mixins |
| M |
| constructors |
| synthetic named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F6 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| element: <testLibrary>::@class::B::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::B::@constructor::named |
| superConstructor: <testLibrary>::@class::B::@constructor::named |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F7 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_constructors_default() async { |
| var library = await buildLibrary(''' |
| class A {} |
| mixin class M {} |
| class X = A with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F3 class M @23 |
| element: <testLibrary>::@class::M |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::M::@constructor::new |
| typeName: M |
| #F5 class X @34 |
| element: <testLibrary>::@class::X |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::X::@constructor::new |
| typeName: X |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| mixin class M |
| reference: <testLibrary>::@class::M |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M::@constructor::new |
| firstFragment: #F4 |
| class alias X |
| reference: <testLibrary>::@class::X |
| firstFragment: #F5 |
| supertype: A |
| mixins |
| M |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::X::@constructor::new |
| firstFragment: #F6 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_classAlias_constructors_dependencies() async { |
| var library = await buildLibrary(''' |
| class A { |
| A(int i); |
| } |
| mixin class M1 {} |
| mixin class M2 {} |
| |
| class C2 = C1 with M2; |
| class C1 = A with M1; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 12 |
| formalParameters |
| #F3 i @18 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::i |
| #F4 class M1 @36 |
| element: <testLibrary>::@class::M1 |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::M1::@constructor::new |
| typeName: M1 |
| #F6 class M2 @54 |
| element: <testLibrary>::@class::M2 |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::M2::@constructor::new |
| typeName: M2 |
| #F8 class C2 @67 |
| element: <testLibrary>::@class::C2 |
| constructors |
| #F9 synthetic new |
| element: <testLibrary>::@class::C2::@constructor::new |
| typeName: C2 |
| formalParameters |
| #F10 i (offset=-1) |
| element: <testLibrary>::@class::C2::@constructor::new::@formalParameter::i |
| #F11 class C1 @90 |
| element: <testLibrary>::@class::C1 |
| constructors |
| #F12 synthetic new |
| element: <testLibrary>::@class::C1::@constructor::new |
| typeName: C1 |
| formalParameters |
| #F13 i (offset=-1) |
| element: <testLibrary>::@class::C1::@constructor::new::@formalParameter::i |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F3 |
| type: int |
| mixin class M1 |
| reference: <testLibrary>::@class::M1 |
| firstFragment: #F4 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M1::@constructor::new |
| firstFragment: #F5 |
| mixin class M2 |
| reference: <testLibrary>::@class::M2 |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M2::@constructor::new |
| firstFragment: #F7 |
| class alias C2 |
| reference: <testLibrary>::@class::C2 |
| firstFragment: #F8 |
| supertype: C1 |
| mixins |
| M2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C2::@constructor::new |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F10 |
| type: int |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: i @-1 |
| element: <testLibrary>::@class::C2::@constructor::new::@formalParameter::i |
| staticType: int |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::C1::@constructor::new |
| superConstructor: <testLibrary>::@class::C1::@constructor::new |
| class alias C1 |
| reference: <testLibrary>::@class::C1 |
| firstFragment: #F11 |
| supertype: A |
| mixins |
| M1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C1::@constructor::new |
| firstFragment: #F12 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F13 |
| type: int |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: i @-1 |
| element: <testLibrary>::@class::C1::@constructor::new::@formalParameter::i |
| staticType: int |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_classAlias_constructors_optionalParameters() async { |
| var library = await buildLibrary(''' |
| class A { |
| A.c1(int a); |
| A.c2(int a, [int? b, int c = 0]); |
| A.c3(int a, {int? b, int c = 0}); |
| } |
| |
| mixin M {} |
| |
| class C = A with M; |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 c1 @14 |
| element: <testLibrary>::@class::A::@constructor::c1 |
| typeName: A |
| typeNameOffset: 12 |
| periodOffset: 13 |
| formalParameters |
| #F3 a @21 |
| element: <testLibrary>::@class::A::@constructor::c1::@formalParameter::a |
| #F4 c2 @29 |
| element: <testLibrary>::@class::A::@constructor::c2 |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| formalParameters |
| #F5 a @36 |
| element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::a |
| #F6 b @45 |
| element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::b |
| #F7 c @52 |
| element: <testLibrary>::@class::A::@constructor::c2::@formalParameter::c |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @56 |
| staticType: int |
| #F8 c3 @65 |
| element: <testLibrary>::@class::A::@constructor::c3 |
| typeName: A |
| typeNameOffset: 63 |
| periodOffset: 64 |
| formalParameters |
| #F9 a @72 |
| element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::a |
| #F10 b @81 |
| element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::b |
| #F11 c @88 |
| element: <testLibrary>::@class::A::@constructor::c3::@formalParameter::c |
| initializer: expression_1 |
| IntegerLiteral |
| literal: 0 @92 |
| staticType: int |
| #F12 class C @118 |
| element: <testLibrary>::@class::C |
| constructors |
| #F13 synthetic c1 |
| element: <testLibrary>::@class::C::@constructor::c1 |
| typeName: C |
| formalParameters |
| #F14 a (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c1::@formalParameter::a |
| #F15 synthetic c2 |
| element: <testLibrary>::@class::C::@constructor::c2 |
| typeName: C |
| formalParameters |
| #F16 a (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::a |
| #F17 b (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::b |
| #F18 c (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::c |
| initializer: expression_0 |
| #F19 synthetic c3 |
| element: <testLibrary>::@class::C::@constructor::c3 |
| typeName: C |
| formalParameters |
| #F20 a (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::a |
| #F21 b (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::b |
| #F22 c (offset=-1) |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::c |
| initializer: expression_1 |
| mixins |
| #F23 mixin M @106 |
| element: <testLibrary>::@mixin::M |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| constructors |
| c1 |
| reference: <testLibrary>::@class::A::@constructor::c1 |
| firstFragment: #F2 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F3 |
| type: int |
| c2 |
| reference: <testLibrary>::@class::A::@constructor::c2 |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F5 |
| type: int |
| optionalPositional b |
| firstFragment: #F6 |
| type: int? |
| optionalPositional c |
| firstFragment: #F7 |
| type: int |
| constantInitializer |
| fragment: #F7 |
| expression: expression_0 |
| c3 |
| reference: <testLibrary>::@class::A::@constructor::c3 |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F9 |
| type: int |
| optionalNamed b |
| firstFragment: #F10 |
| type: int? |
| optionalNamed c |
| firstFragment: #F11 |
| type: int |
| constantInitializer |
| fragment: #F11 |
| expression: expression_1 |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F12 |
| supertype: A |
| mixins |
| M |
| constructors |
| synthetic c1 |
| reference: <testLibrary>::@class::C::@constructor::c1 |
| firstFragment: #F13 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F14 |
| type: int |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: c1 @-1 |
| element: <testLibrary>::@class::A::@constructor::c1 |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: a @-1 |
| element: <testLibrary>::@class::C::@constructor::c1::@formalParameter::a |
| staticType: int |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::c1 |
| superConstructor: <testLibrary>::@class::A::@constructor::c1 |
| synthetic c2 |
| reference: <testLibrary>::@class::C::@constructor::c2 |
| firstFragment: #F15 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F16 |
| type: int |
| optionalPositional b |
| firstFragment: #F17 |
| type: int? |
| optionalPositional c |
| firstFragment: #F18 |
| type: int |
| constantInitializer |
| fragment: #F18 |
| expression: expression_0 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: c2 @-1 |
| element: <testLibrary>::@class::A::@constructor::c2 |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: a @-1 |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::a |
| staticType: int |
| SimpleIdentifier |
| token: b @-1 |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::b |
| staticType: int? |
| SimpleIdentifier |
| token: c @-1 |
| element: <testLibrary>::@class::C::@constructor::c2::@formalParameter::c |
| staticType: int |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::c2 |
| superConstructor: <testLibrary>::@class::A::@constructor::c2 |
| synthetic c3 |
| reference: <testLibrary>::@class::C::@constructor::c3 |
| firstFragment: #F19 |
| formalParameters |
| requiredPositional a |
| firstFragment: #F20 |
| type: int |
| optionalNamed b |
| firstFragment: #F21 |
| type: int? |
| optionalNamed c |
| firstFragment: #F22 |
| type: int |
| constantInitializer |
| fragment: #F22 |
| expression: expression_1 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: c3 @-1 |
| element: <testLibrary>::@class::A::@constructor::c3 |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: a @-1 |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::a |
| staticType: int |
| SimpleIdentifier |
| token: b @-1 |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::b |
| staticType: int? |
| SimpleIdentifier |
| token: c @-1 |
| element: <testLibrary>::@class::C::@constructor::c3::@formalParameter::c |
| staticType: int |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::c3 |
| superConstructor: <testLibrary>::@class::A::@constructor::c3 |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F23 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_constructors_requiredParameters() async { |
| var library = await buildLibrary(''' |
| class A<T extends num> { |
| A(T x, T y); |
| } |
| |
| mixin M {} |
| |
| class B<E extends num> = A<E> with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @6 |
| element: <testLibrary>::@class::A |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| typeNameOffset: 27 |
| formalParameters |
| #F4 x @31 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::x |
| #F5 y @36 |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::y |
| #F6 class B @61 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F7 E @63 |
| element: #E1 E |
| constructors |
| #F8 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| formalParameters |
| #F9 x (offset=-1) |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x |
| #F10 y (offset=-1) |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::y |
| mixins |
| #F11 mixin M @49 |
| element: <testLibrary>::@mixin::M |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: num |
| constructors |
| new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F4 |
| type: T |
| requiredPositional y |
| firstFragment: #F5 |
| type: T |
| class alias B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F6 |
| typeParameters |
| #E1 E |
| firstFragment: #F7 |
| bound: num |
| supertype: A<E> |
| mixins |
| M |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F9 |
| type: E |
| requiredPositional y |
| firstFragment: #F10 |
| type: E |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::x |
| staticType: E |
| SimpleIdentifier |
| token: y @-1 |
| element: <testLibrary>::@class::B::@constructor::new::@formalParameter::y |
| staticType: E |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::A::@constructor::new |
| substitution: {T: E} |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F11 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_documented() async { |
| var library = await buildLibrary(''' |
| /** |
| * Docs |
| */ |
| class C = D with E; |
| |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @22 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @43 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @54 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs\n */ |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_classAlias_documented_tripleSlash() async { |
| var library = await buildLibrary(''' |
| /// aaa |
| /// b |
| /// cc |
| class C = D with E; |
| |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @27 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @48 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @59 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /// aaa\n/// b\n/// cc |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_classAlias_documented_withLeadingNonDocumentation() async { |
| var library = await buildLibrary(''' |
| // Extra comment so doc comment offset != 0 |
| /** |
| * Docs |
| */ |
| class C = D with E; |
| |
| class D {} |
| class E {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @66 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @87 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @98 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| documentationComment: /**\n * Docs\n */ |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_classAlias_final() async { |
| var library = await buildLibrary(''' |
| final class C = Object with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @12 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F3 mixin M @37 |
| element: <testLibrary>::@mixin::M |
| classes |
| final class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_generic() async { |
| var library = await buildLibrary(''' |
| class Z = A with B<int>, C<double>; |
| class A {} |
| class B<B1> {} |
| class C<C1> {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class Z @6 |
| element: <testLibrary>::@class::Z |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::Z::@constructor::new |
| typeName: Z |
| #F3 class A @42 |
| element: <testLibrary>::@class::A |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| #F5 class B @53 |
| element: <testLibrary>::@class::B |
| typeParameters |
| #F6 B1 @55 |
| element: #E0 B1 |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::B::@constructor::new |
| typeName: B |
| #F8 class C @68 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F9 C1 @70 |
| element: #E1 C1 |
| constructors |
| #F10 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| classes |
| class alias Z |
| reference: <testLibrary>::@class::Z |
| firstFragment: #F1 |
| supertype: A |
| mixins |
| B<int> |
| C<double> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::Z::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::A::@constructor::new |
| superConstructor: <testLibrary>::@class::A::@constructor::new |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F4 |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: #F5 |
| typeParameters |
| #E0 B1 |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::B::@constructor::new |
| firstFragment: #F7 |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F8 |
| typeParameters |
| #E1 C1 |
| firstFragment: #F9 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F10 |
| '''); |
| } |
| |
| test_classAlias_interface() async { |
| var library = await buildLibrary(''' |
| interface class C = Object with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @16 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F3 mixin M @41 |
| element: <testLibrary>::@mixin::M |
| classes |
| interface class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_invalid_extendsEnum() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| enum E { v } |
| mixin M {} |
| '''); |
| |
| var library = await buildLibrary(''' |
| import 'a.dart'; |
| class A = E with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| classes |
| #F1 class A @23 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| classes |
| class alias A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| '''); |
| } |
| |
| test_classAlias_invalid_extendsMixin() async { |
| var library = await buildLibrary(''' |
| mixin M1 {} |
| mixin M2 {} |
| class A = M1 with M2; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class A @30 |
| element: <testLibrary>::@class::A |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::A::@constructor::new |
| typeName: A |
| mixins |
| #F3 mixin M1 @6 |
| element: <testLibrary>::@mixin::M1 |
| #F4 mixin M2 @18 |
| element: <testLibrary>::@mixin::M2 |
| classes |
| class alias A |
| reference: <testLibrary>::@class::A |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M2 |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::A::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M1 |
| reference: <testLibrary>::@mixin::M1 |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| mixin M2 |
| reference: <testLibrary>::@mixin::M2 |
| firstFragment: #F4 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_mixin_class() async { |
| var library = await buildLibrary(''' |
| mixin class C = Object with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @12 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F3 mixin M @37 |
| element: <testLibrary>::@mixin::M |
| classes |
| mixin class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_notSimplyBounded_self() async { |
| var library = await buildLibrary(''' |
| class C<T extends C> = D with E; |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @39 |
| element: <testLibrary>::@class::D |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F6 class E @50 |
| element: <testLibrary>::@class::E |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| notSimplyBounded class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| bound: C<dynamic> |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F5 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F7 |
| '''); |
| } |
| |
| test_classAlias_notSimplyBounded_simple_no_type_parameter_bound() async { |
| // If no bounds are specified, then the class is simply bounded by syntax |
| // alone, so there is no reason to assign it a slot. |
| var library = await buildLibrary(''' |
| class C<T> = D with E; |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F4 class D @29 |
| element: <testLibrary>::@class::D |
| constructors |
| #F5 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F6 class E @40 |
| element: <testLibrary>::@class::E |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F4 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F5 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F7 |
| '''); |
| } |
| |
| test_classAlias_notSimplyBounded_simple_non_generic() async { |
| // If no type parameters are specified, then the class is simply bounded, so |
| // there is no reason to assign it a slot. |
| var library = await buildLibrary(''' |
| class C = D with E; |
| class D {} |
| class E {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @26 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @37 |
| element: <testLibrary>::@class::E |
| constructors |
| #F6 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F6 |
| '''); |
| } |
| |
| test_classAlias_sealed() async { |
| var library = await buildLibrary(''' |
| sealed class C = Object with M; |
| mixin M {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @13 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic const new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| mixins |
| #F3 mixin M @38 |
| element: <testLibrary>::@mixin::M |
| classes |
| abstract sealed class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: Object |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: dart:core::@class::Object::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: #F3 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_classAlias_with_const_constructors() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class Base { |
| const Base._priv(); |
| const Base(); |
| const Base.named(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "a.dart"; |
| class M {} |
| class MixinApp = Base with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| classes |
| #F1 class M @23 |
| element: <testLibrary>::@class::M |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::M::@constructor::new |
| typeName: M |
| #F3 class MixinApp @34 |
| element: <testLibrary>::@class::MixinApp |
| constructors |
| #F4 synthetic const new |
| element: <testLibrary>::@class::MixinApp::@constructor::new |
| typeName: MixinApp |
| #F5 synthetic const named |
| element: <testLibrary>::@class::MixinApp::@constructor::named |
| typeName: MixinApp |
| classes |
| class M |
| reference: <testLibrary>::@class::M |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M::@constructor::new |
| firstFragment: #F2 |
| class alias MixinApp |
| reference: <testLibrary>::@class::MixinApp |
| firstFragment: #F3 |
| supertype: Base |
| mixins |
| M |
| constructors |
| synthetic const new |
| reference: <testLibrary>::@class::MixinApp::@constructor::new |
| firstFragment: #F4 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::new |
| superConstructor: package:test/a.dart::@class::Base::@constructor::new |
| synthetic const named |
| reference: <testLibrary>::@class::MixinApp::@constructor::named |
| firstFragment: #F5 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| element: package:test/a.dart::@class::Base::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::named |
| superConstructor: package:test/a.dart::@class::Base::@constructor::named |
| '''); |
| } |
| |
| test_classAlias_with_forwarding_constructors() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class Base { |
| bool x = true; |
| Base._priv(); |
| Base(); |
| Base.noArgs(); |
| Base.requiredArg(x); |
| Base.positionalArg([bool x = true]); |
| Base.positionalArg2([this.x = true]); |
| Base.namedArg({int x = 42}); |
| Base.namedArg2({this.x = true}); |
| factory Base.fact() => Base(); |
| factory Base.fact2() = Base.noArgs; |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "a.dart"; |
| class M {} |
| class MixinApp = Base with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| classes |
| #F1 class M @23 |
| element: <testLibrary>::@class::M |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::M::@constructor::new |
| typeName: M |
| #F3 class MixinApp @34 |
| element: <testLibrary>::@class::MixinApp |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::MixinApp::@constructor::new |
| typeName: MixinApp |
| #F5 synthetic noArgs |
| element: <testLibrary>::@class::MixinApp::@constructor::noArgs |
| typeName: MixinApp |
| #F6 synthetic requiredArg |
| element: <testLibrary>::@class::MixinApp::@constructor::requiredArg |
| typeName: MixinApp |
| formalParameters |
| #F7 x (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::requiredArg::@formalParameter::x |
| #F8 synthetic positionalArg |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg |
| typeName: MixinApp |
| formalParameters |
| #F9 x (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg::@formalParameter::x |
| initializer: expression_0 |
| BooleanLiteral |
| literal: true @127 |
| staticType: bool |
| #F10 synthetic positionalArg2 |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2 |
| typeName: MixinApp |
| formalParameters |
| #F11 x (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2::@formalParameter::x |
| initializer: expression_1 |
| BooleanLiteral |
| literal: true @167 |
| staticType: bool |
| #F12 synthetic namedArg |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg |
| typeName: MixinApp |
| formalParameters |
| #F13 x (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg::@formalParameter::x |
| initializer: expression_2 |
| IntegerLiteral |
| literal: 42 @200 |
| staticType: int |
| #F14 synthetic namedArg2 |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg2 |
| typeName: MixinApp |
| formalParameters |
| #F15 x (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg2::@formalParameter::x |
| initializer: expression_3 |
| BooleanLiteral |
| literal: true @233 |
| staticType: bool |
| classes |
| class M |
| reference: <testLibrary>::@class::M |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M::@constructor::new |
| firstFragment: #F2 |
| class alias MixinApp |
| reference: <testLibrary>::@class::MixinApp |
| firstFragment: #F3 |
| supertype: Base |
| mixins |
| M |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::MixinApp::@constructor::new |
| firstFragment: #F4 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::new |
| superConstructor: package:test/a.dart::@class::Base::@constructor::new |
| synthetic noArgs |
| reference: <testLibrary>::@class::MixinApp::@constructor::noArgs |
| firstFragment: #F5 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: noArgs @-1 |
| element: package:test/a.dart::@class::Base::@constructor::noArgs |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::noArgs |
| superConstructor: package:test/a.dart::@class::Base::@constructor::noArgs |
| synthetic requiredArg |
| reference: <testLibrary>::@class::MixinApp::@constructor::requiredArg |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional x |
| firstFragment: #F7 |
| type: dynamic |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: requiredArg @-1 |
| element: package:test/a.dart::@class::Base::@constructor::requiredArg |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::requiredArg::@formalParameter::x |
| staticType: dynamic |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::requiredArg |
| superConstructor: package:test/a.dart::@class::Base::@constructor::requiredArg |
| synthetic positionalArg |
| reference: <testLibrary>::@class::MixinApp::@constructor::positionalArg |
| firstFragment: #F8 |
| formalParameters |
| optionalPositional x |
| firstFragment: #F9 |
| type: bool |
| constantInitializer |
| fragment: #F9 |
| expression: expression_0 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: positionalArg @-1 |
| element: package:test/a.dart::@class::Base::@constructor::positionalArg |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg::@formalParameter::x |
| staticType: bool |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::positionalArg |
| superConstructor: package:test/a.dart::@class::Base::@constructor::positionalArg |
| synthetic positionalArg2 |
| reference: <testLibrary>::@class::MixinApp::@constructor::positionalArg2 |
| firstFragment: #F10 |
| formalParameters |
| optionalPositional final x |
| firstFragment: #F11 |
| type: bool |
| constantInitializer |
| fragment: #F11 |
| expression: expression_1 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: positionalArg2 @-1 |
| element: package:test/a.dart::@class::Base::@constructor::positionalArg2 |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::positionalArg2::@formalParameter::x |
| staticType: bool |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::positionalArg2 |
| superConstructor: package:test/a.dart::@class::Base::@constructor::positionalArg2 |
| synthetic namedArg |
| reference: <testLibrary>::@class::MixinApp::@constructor::namedArg |
| firstFragment: #F12 |
| formalParameters |
| optionalNamed x |
| firstFragment: #F13 |
| type: int |
| constantInitializer |
| fragment: #F13 |
| expression: expression_2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: namedArg @-1 |
| element: package:test/a.dart::@class::Base::@constructor::namedArg |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg::@formalParameter::x |
| staticType: int |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::namedArg |
| superConstructor: package:test/a.dart::@class::Base::@constructor::namedArg |
| synthetic namedArg2 |
| reference: <testLibrary>::@class::MixinApp::@constructor::namedArg2 |
| firstFragment: #F14 |
| formalParameters |
| optionalNamed final x |
| firstFragment: #F15 |
| type: bool |
| constantInitializer |
| fragment: #F15 |
| expression: expression_3 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: namedArg2 @-1 |
| element: package:test/a.dart::@class::Base::@constructor::namedArg2 |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: x @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::namedArg2::@formalParameter::x |
| staticType: bool |
| rightParenthesis: ) @0 |
| element: package:test/a.dart::@class::Base::@constructor::namedArg2 |
| superConstructor: package:test/a.dart::@class::Base::@constructor::namedArg2 |
| '''); |
| } |
| |
| test_classAlias_with_forwarding_constructors_type_substitution() async { |
| var library = await buildLibrary(''' |
| class Base<T> { |
| Base.ctor(T t, List<T> l); |
| } |
| class M {} |
| class MixinApp = Base with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class Base @6 |
| element: <testLibrary>::@class::Base |
| typeParameters |
| #F2 T @11 |
| element: #E0 T |
| constructors |
| #F3 ctor @23 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| typeName: Base |
| typeNameOffset: 18 |
| periodOffset: 22 |
| formalParameters |
| #F4 t @30 |
| element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::t |
| #F5 l @41 |
| element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::l |
| #F6 class M @53 |
| element: <testLibrary>::@class::M |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::M::@constructor::new |
| typeName: M |
| #F8 class MixinApp @64 |
| element: <testLibrary>::@class::MixinApp |
| constructors |
| #F9 synthetic ctor |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor |
| typeName: MixinApp |
| formalParameters |
| #F10 t (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t |
| #F11 l (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l |
| classes |
| class Base |
| reference: <testLibrary>::@class::Base |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| ctor |
| reference: <testLibrary>::@class::Base::@constructor::ctor |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F4 |
| type: T |
| requiredPositional l |
| firstFragment: #F5 |
| type: List<T> |
| class M |
| reference: <testLibrary>::@class::M |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M::@constructor::new |
| firstFragment: #F7 |
| class alias MixinApp |
| reference: <testLibrary>::@class::MixinApp |
| firstFragment: #F8 |
| supertype: Base<dynamic> |
| mixins |
| M |
| constructors |
| synthetic ctor |
| reference: <testLibrary>::@class::MixinApp::@constructor::ctor |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F10 |
| type: dynamic |
| requiredPositional l |
| firstFragment: #F11 |
| type: List<dynamic> |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: ctor @-1 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: t @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t |
| staticType: dynamic |
| SimpleIdentifier |
| token: l @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l |
| staticType: List<dynamic> |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::Base::@constructor::ctor |
| substitution: {T: dynamic} |
| '''); |
| } |
| |
| test_classAlias_with_forwarding_constructors_type_substitution_complex() async { |
| var library = await buildLibrary(''' |
| class Base<T> { |
| Base.ctor(T t, List<T> l); |
| } |
| class M {} |
| class MixinApp<U> = Base<List<U>> with M; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class Base @6 |
| element: <testLibrary>::@class::Base |
| typeParameters |
| #F2 T @11 |
| element: #E0 T |
| constructors |
| #F3 ctor @23 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| typeName: Base |
| typeNameOffset: 18 |
| periodOffset: 22 |
| formalParameters |
| #F4 t @30 |
| element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::t |
| #F5 l @41 |
| element: <testLibrary>::@class::Base::@constructor::ctor::@formalParameter::l |
| #F6 class M @53 |
| element: <testLibrary>::@class::M |
| constructors |
| #F7 synthetic new |
| element: <testLibrary>::@class::M::@constructor::new |
| typeName: M |
| #F8 class MixinApp @64 |
| element: <testLibrary>::@class::MixinApp |
| typeParameters |
| #F9 U @73 |
| element: #E1 U |
| constructors |
| #F10 synthetic ctor |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor |
| typeName: MixinApp |
| formalParameters |
| #F11 t (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t |
| #F12 l (offset=-1) |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l |
| classes |
| class Base |
| reference: <testLibrary>::@class::Base |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| ctor |
| reference: <testLibrary>::@class::Base::@constructor::ctor |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F4 |
| type: T |
| requiredPositional l |
| firstFragment: #F5 |
| type: List<T> |
| class M |
| reference: <testLibrary>::@class::M |
| firstFragment: #F6 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::M::@constructor::new |
| firstFragment: #F7 |
| class alias MixinApp |
| reference: <testLibrary>::@class::MixinApp |
| firstFragment: #F8 |
| typeParameters |
| #E1 U |
| firstFragment: #F9 |
| supertype: Base<List<U>> |
| mixins |
| M |
| constructors |
| synthetic ctor |
| reference: <testLibrary>::@class::MixinApp::@constructor::ctor |
| firstFragment: #F10 |
| formalParameters |
| requiredPositional t |
| firstFragment: #F11 |
| type: List<U> |
| requiredPositional l |
| firstFragment: #F12 |
| type: List<List<U>> |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: ctor @-1 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| arguments |
| SimpleIdentifier |
| token: t @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::t |
| staticType: List<U> |
| SimpleIdentifier |
| token: l @-1 |
| element: <testLibrary>::@class::MixinApp::@constructor::ctor::@formalParameter::l |
| staticType: List<List<U>> |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::Base::@constructor::ctor |
| superConstructor: ConstructorMember |
| baseElement: <testLibrary>::@class::Base::@constructor::ctor |
| substitution: {T: List<U>} |
| '''); |
| } |
| |
| test_classAlias_with_mixin_members() async { |
| var library = await buildLibrary(''' |
| class C = D with E; |
| class D {} |
| class E { |
| int get a => null; |
| void set b(int i) {} |
| void f() {} |
| int x; |
| }'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @26 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| #F5 class E @37 |
| element: <testLibrary>::@class::E |
| fields |
| #F6 synthetic a |
| element: <testLibrary>::@class::E::@field::a |
| #F7 synthetic b |
| element: <testLibrary>::@class::E::@field::b |
| #F8 x @105 |
| element: <testLibrary>::@class::E::@field::x |
| constructors |
| #F9 synthetic new |
| element: <testLibrary>::@class::E::@constructor::new |
| typeName: E |
| getters |
| #F10 a @51 |
| element: <testLibrary>::@class::E::@getter::a |
| returnType: int |
| #F11 synthetic x |
| element: <testLibrary>::@class::E::@getter::x |
| returnType: int |
| setters |
| #F12 b @73 |
| element: <testLibrary>::@class::E::@setter::b |
| formalParameters |
| #F13 i @79 |
| element: <testLibrary>::@class::E::@setter::b::@formalParameter::i |
| #F14 synthetic x |
| element: <testLibrary>::@class::E::@setter::x |
| formalParameters |
| #F15 _x |
| element: <testLibrary>::@class::E::@setter::x::@formalParameter::_x |
| methods |
| #F16 f @92 |
| element: <testLibrary>::@class::E::@method::f |
| classes |
| class alias C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| element: <testLibrary>::@class::D::@constructor::new |
| superConstructor: <testLibrary>::@class::D::@constructor::new |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| class E |
| reference: <testLibrary>::@class::E |
| firstFragment: #F5 |
| fields |
| synthetic a |
| reference: <testLibrary>::@class::E::@field::a |
| firstFragment: #F6 |
| type: int |
| getter: <testLibrary>::@class::E::@getter::a |
| synthetic b |
| reference: <testLibrary>::@class::E::@field::b |
| firstFragment: #F7 |
| type: int |
| setter: <testLibrary>::@class::E::@setter::b |
| x |
| reference: <testLibrary>::@class::E::@field::x |
| firstFragment: #F8 |
| type: int |
| getter: <testLibrary>::@class::E::@getter::x |
| setter: <testLibrary>::@class::E::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::E::@constructor::new |
| firstFragment: #F9 |
| getters |
| a |
| reference: <testLibrary>::@class::E::@getter::a |
| firstFragment: #F10 |
| returnType: int |
| variable: <testLibrary>::@class::E::@field::a |
| synthetic x |
| reference: <testLibrary>::@class::E::@getter::x |
| firstFragment: #F11 |
| returnType: int |
| variable: <testLibrary>::@class::E::@field::x |
| setters |
| b |
| reference: <testLibrary>::@class::E::@setter::b |
| firstFragment: #F12 |
| formalParameters |
| requiredPositional i |
| firstFragment: #F13 |
| type: int |
| returnType: void |
| synthetic x |
| reference: <testLibrary>::@class::E::@setter::x |
| firstFragment: #F14 |
| formalParameters |
| requiredPositional _x |
| firstFragment: #F15 |
| type: int |
| returnType: void |
| methods |
| f |
| reference: <testLibrary>::@class::E::@method::f |
| firstFragment: #F16 |
| returnType: void |
| '''); |
| } |
| |
| test_classes() async { |
| var library = await buildLibrary('class C {} class D {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| constructors |
| #F2 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| #F3 class D @17 |
| element: <testLibrary>::@class::D |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::D::@constructor::new |
| typeName: D |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F2 |
| class D |
| reference: <testLibrary>::@class::D |
| firstFragment: #F3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::D::@constructor::new |
| firstFragment: #F4 |
| '''); |
| } |
| |
| test_implicitConstructor_named_const() async { |
| var library = await buildLibrary(''' |
| class C { |
| final Object x; |
| const C.named(this.x); |
| } |
| const x = C.named(42); |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 x @25 |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 const named @38 |
| element: <testLibrary>::@class::C::@constructor::named |
| typeName: C |
| typeNameOffset: 36 |
| periodOffset: 37 |
| formalParameters |
| #F4 this.x @49 |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::x |
| getters |
| #F5 synthetic x |
| element: <testLibrary>::@class::C::@getter::x |
| returnType: Object |
| topLevelVariables |
| #F6 hasInitializer x @61 |
| element: <testLibrary>::@topLevelVariable::x |
| initializer: expression_0 |
| InstanceCreationExpression |
| constructorName: ConstructorName |
| type: NamedType |
| name: C @65 |
| element2: <testLibrary>::@class::C |
| type: C |
| period: . @66 |
| name: SimpleIdentifier |
| token: named @67 |
| element: <testLibrary>::@class::C::@constructor::named |
| staticType: null |
| element: <testLibrary>::@class::C::@constructor::named |
| argumentList: ArgumentList |
| leftParenthesis: ( @72 |
| arguments |
| IntegerLiteral |
| literal: 42 @73 |
| staticType: int |
| rightParenthesis: ) @75 |
| staticType: C |
| getters |
| #F7 synthetic x |
| element: <testLibrary>::@getter::x |
| returnType: C |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| final x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: Object |
| getter: <testLibrary>::@class::C::@getter::x |
| constructors |
| const named |
| reference: <testLibrary>::@class::C::@constructor::named |
| firstFragment: #F3 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F4 |
| type: Object |
| getters |
| synthetic x |
| reference: <testLibrary>::@class::C::@getter::x |
| firstFragment: #F5 |
| returnType: Object |
| variable: <testLibrary>::@class::C::@field::x |
| topLevelVariables |
| const hasInitializer x |
| reference: <testLibrary>::@topLevelVariable::x |
| firstFragment: #F6 |
| type: C |
| constantInitializer |
| fragment: #F6 |
| expression: expression_0 |
| getter: <testLibrary>::@getter::x |
| getters |
| synthetic static x |
| reference: <testLibrary>::@getter::x |
| firstFragment: #F7 |
| returnType: C |
| variable: <testLibrary>::@topLevelVariable::x |
| '''); |
| } |
| |
| test_invalid_setterParameter_fieldFormalParameter() async { |
| var library = await buildLibrary(''' |
| class C { |
| int foo; |
| void set bar(this.foo) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 foo @16 |
| element: <testLibrary>::@class::C::@field::foo |
| #F3 synthetic bar |
| element: <testLibrary>::@class::C::@field::bar |
| constructors |
| #F4 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| getters |
| #F5 synthetic foo |
| element: <testLibrary>::@class::C::@getter::foo |
| returnType: int |
| setters |
| #F6 synthetic foo |
| element: <testLibrary>::@class::C::@setter::foo |
| formalParameters |
| #F7 _foo |
| element: <testLibrary>::@class::C::@setter::foo::@formalParameter::_foo |
| #F8 bar @32 |
| element: <testLibrary>::@class::C::@setter::bar |
| formalParameters |
| #F9 this.foo @41 |
| element: <testLibrary>::@class::C::@setter::bar::@formalParameter::foo |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| foo |
| reference: <testLibrary>::@class::C::@field::foo |
| firstFragment: #F2 |
| type: int |
| getter: <testLibrary>::@class::C::@getter::foo |
| setter: <testLibrary>::@class::C::@setter::foo |
| synthetic bar |
| reference: <testLibrary>::@class::C::@field::bar |
| firstFragment: #F3 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::bar |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F4 |
| getters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@getter::foo |
| firstFragment: #F5 |
| returnType: int |
| variable: <testLibrary>::@class::C::@field::foo |
| setters |
| synthetic foo |
| reference: <testLibrary>::@class::C::@setter::foo |
| firstFragment: #F6 |
| formalParameters |
| requiredPositional _foo |
| firstFragment: #F7 |
| type: int |
| returnType: void |
| bar |
| reference: <testLibrary>::@class::C::@setter::bar |
| firstFragment: #F8 |
| formalParameters |
| requiredPositional final hasImplicitType foo |
| firstFragment: #F9 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_invalid_setterParameter_fieldFormalParameter_self() async { |
| var library = await buildLibrary(''' |
| class C { |
| set x(this.x) {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| fields |
| #F2 synthetic x |
| element: <testLibrary>::@class::C::@field::x |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| setters |
| #F4 x @16 |
| element: <testLibrary>::@class::C::@setter::x |
| formalParameters |
| #F5 this.x @23 |
| element: <testLibrary>::@class::C::@setter::x::@formalParameter::x |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| fields |
| synthetic x |
| reference: <testLibrary>::@class::C::@field::x |
| firstFragment: #F2 |
| type: dynamic |
| setter: <testLibrary>::@class::C::@setter::x |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| setters |
| x |
| reference: <testLibrary>::@class::C::@setter::x |
| firstFragment: #F4 |
| formalParameters |
| requiredPositional final hasImplicitType x |
| firstFragment: #F5 |
| type: dynamic |
| returnType: void |
| '''); |
| } |
| |
| test_unused_type_parameter() async { |
| var library = await buildLibrary(''' |
| class C<T> { |
| void f() {} |
| } |
| C<int> c; |
| var v = c.f; |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| fragments |
| #F0 <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| #F1 class C @6 |
| element: <testLibrary>::@class::C |
| typeParameters |
| #F2 T @8 |
| element: #E0 T |
| constructors |
| #F3 synthetic new |
| element: <testLibrary>::@class::C::@constructor::new |
| typeName: C |
| methods |
| #F4 f @20 |
| element: <testLibrary>::@class::C::@method::f |
| topLevelVariables |
| #F5 c @36 |
| element: <testLibrary>::@topLevelVariable::c |
| #F6 hasInitializer v @43 |
| element: <testLibrary>::@topLevelVariable::v |
| getters |
| #F7 synthetic c |
| element: <testLibrary>::@getter::c |
| returnType: C<int> |
| #F8 synthetic v |
| element: <testLibrary>::@getter::v |
| returnType: void Function() |
| setters |
| #F9 synthetic c |
| element: <testLibrary>::@setter::c |
| formalParameters |
| #F10 _c |
| element: <testLibrary>::@setter::c::@formalParameter::_c |
| #F11 synthetic v |
| element: <testLibrary>::@setter::v |
| formalParameters |
| #F12 _v |
| element: <testLibrary>::@setter::v::@formalParameter::_v |
| classes |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: #F1 |
| typeParameters |
| #E0 T |
| firstFragment: #F2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@class::C::@constructor::new |
| firstFragment: #F3 |
| methods |
| f |
| reference: <testLibrary>::@class::C::@method::f |
| firstFragment: #F4 |
| returnType: void |
| topLevelVariables |
| c |
| reference: <testLibrary>::@topLevelVariable::c |
| firstFragment: #F5 |
| type: C<int> |
| getter: <testLibrary>::@getter::c |
| setter: <testLibrary>::@setter::c |
| hasInitializer v |
| reference: <testLibrary>::@topLevelVariable::v |
| firstFragment: #F6 |
| type: void Function() |
| getter: <testLibrary>::@getter::v |
| setter: <testLibrary>::@setter::v |
| getters |
| synthetic static c |
| reference: <testLibrary>::@getter::c |
| firstFragment: #F7 |
| returnType: C<int> |
| variable: <testLibrary>::@topLevelVariable::c |
| synthetic static v |
| reference: <testLibrary>::@getter::v |
| firstFragment: #F8 |
| returnType: void Function() |
| variable: <testLibrary>::@topLevelVariable::v |
| setters |
| synthetic static c |
| reference: <testLibrary>::@setter::c |
| firstFragment: #F9 |
| formalParameters |
| requiredPositional _c |
| firstFragment: #F10 |
| type: C<int> |
| returnType: void |
| synthetic static v |
| reference: <testLibrary>::@setter::v |
| firstFragment: #F11 |
| formalParameters |
| requiredPositional _v |
| firstFragment: #F12 |
| type: void Function() |
| returnType: void |
| '''); |
| } |
| } |
| |
| abstract class ClassElementTest_augmentation extends ElementsBaseTest { |
| test_add_augment() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| |
| class A { |
| void foo() {} |
| } |
| |
| augment class A { |
| void bar() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class A @28 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| foo @39 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo |
| augment class A @65 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| bar @76 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @28 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @39 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo#element |
| class A @65 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| bar @76 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo |
| bar |
| reference: <testLibrary>::@class::A::@method::bar |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| '''); |
| } |
| |
| test_augmentation_constField_hasConstConstructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| static const int foo = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| const A(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const @33 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| static const foo @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @64 |
| staticType: int |
| accessors |
| synthetic static get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 33 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @64 |
| staticType: int |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| static const hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| constantInitializer |
| fragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| expression: expression_0 |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| const new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic static get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmentation_constField_noConstConstructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| static const int foo = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| static const foo @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @64 |
| staticType: int |
| accessors |
| synthetic static get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @64 |
| staticType: int |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| static const hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| constantInitializer |
| fragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| expression: expression_0 |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic static get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmentation_finalField_hasConstConstructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| final int foo = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| const A(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const @33 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| final foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @57 |
| staticType: int |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 33 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @57 |
| staticType: int |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| constantInitializer |
| fragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| expression: expression_0 |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| const new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmentation_finalField_noConstConstructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| final int foo = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| final foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmentationTarget() async { |
| newFile('$testPackageLibPath/a1.dart', r''' |
| part of 'test.dart'; |
| part 'a11.dart'; |
| part 'a12.dart'; |
| augment class A {} |
| '''); |
| |
| newFile('$testPackageLibPath/a11.dart', r''' |
| part of 'a1.dart'; |
| augment class A {} |
| '''); |
| |
| newFile('$testPackageLibPath/a12.dart', r''' |
| part of 'a1.dart'; |
| augment class A {} |
| '''); |
| |
| newFile('$testPackageLibPath/a2.dart', r''' |
| part of 'test.dart'; |
| part 'a21.dart'; |
| part 'a22.dart'; |
| augment class A {} |
| '''); |
| |
| newFile('$testPackageLibPath/a21.dart', r''' |
| part of 'a2.dart'; |
| augment class A {} |
| '''); |
| |
| newFile('$testPackageLibPath/a22.dart', r''' |
| part of 'a2.dart'; |
| augment class A {} |
| '''); |
| |
| configuration.withExportScope = true; |
| var library = await buildLibrary(r''' |
| part 'a1.dart'; |
| part 'a2.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a1.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a1.dart |
| part_1 |
| uri: package:test/a2.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a2.dart |
| classes |
| class A @38 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a1.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_2 |
| uri: package:test/a11.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a1.dart |
| unit: <testLibrary>::@fragment::package:test/a11.dart |
| part_3 |
| uri: package:test/a12.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a1.dart |
| unit: <testLibrary>::@fragment::package:test/a12.dart |
| classes |
| augment class A @69 |
| reference: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a1.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a11.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a1.dart |
| classes |
| augment class A @33 |
| reference: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a11.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| augmentation: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a12.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a1.dart |
| classes |
| augment class A @33 |
| reference: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a12.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| augmentation: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a2.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_4 |
| uri: package:test/a21.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a2.dart |
| unit: <testLibrary>::@fragment::package:test/a21.dart |
| part_5 |
| uri: package:test/a22.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a2.dart |
| unit: <testLibrary>::@fragment::package:test/a22.dart |
| classes |
| augment class A @69 |
| reference: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a2.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| augmentation: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a21.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a2.dart |
| classes |
| augment class A @33 |
| reference: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a21.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| augmentation: <testLibrary>::@fragment::package:test/a22.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a22.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a2.dart |
| classes |
| augment class A @33 |
| reference: <testLibrary>::@fragment::package:test/a22.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a22.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| exportedReferences |
| declared <testLibraryFragment>::@class::A |
| exportNamespace |
| A: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a1.dart |
| classes |
| class A @38 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a1.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/a11.dart |
| classes |
| class A @69 |
| reference: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a11.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a1.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a1.dart |
| nextFragment: <testLibrary>::@fragment::package:test/a12.dart |
| classes |
| class A @33 |
| reference: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a1.dart::@classAugmentation::A |
| nextFragment: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a12.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a1.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a11.dart |
| nextFragment: <testLibrary>::@fragment::package:test/a2.dart |
| classes |
| class A @33 |
| reference: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a11.dart::@classAugmentation::A |
| nextFragment: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a2.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a12.dart |
| nextFragment: <testLibrary>::@fragment::package:test/a21.dart |
| classes |
| class A @69 |
| reference: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a12.dart::@classAugmentation::A |
| nextFragment: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a21.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a2.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a2.dart |
| nextFragment: <testLibrary>::@fragment::package:test/a22.dart |
| classes |
| class A @33 |
| reference: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a2.dart::@classAugmentation::A |
| nextFragment: <testLibrary>::@fragment::package:test/a22.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a22.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a2.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a21.dart |
| classes |
| class A @33 |
| reference: <testLibrary>::@fragment::package:test/a22.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a21.dart::@classAugmentation::A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| exportedReferences |
| declared <testLibraryFragment>::@class::A |
| exportNamespace |
| A: <testLibraryFragment>::@class::A |
| '''); |
| } |
| |
| test_augmentationTarget_augmentationThenDeclaration() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| |
| augment class A { |
| void foo1() {} |
| } |
| |
| class A { |
| void foo2() {} |
| } |
| |
| augment class A { |
| void foo3() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| methods |
| foo1 @47 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@method::foo1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| returnType: void |
| class A @66 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| foo2 @77 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo2 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@method::foo3 |
| augment class A @104 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| foo3 @115 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@method::foo3 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| element: <testLibrary>::@class::A::@def::0 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@constructor::new#element |
| typeName: A |
| methods |
| foo1 @47 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@method::foo1 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@method::foo1#element |
| class A @66 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| element: <testLibrary>::@class::A::@def::1 |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo2 @77 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo2#element |
| class A @104 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| element: <testLibrary>::@class::A::@def::1 |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| methods |
| foo3 @115 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@method::foo3 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@method::foo3#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A::@def::0 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@constructor::new |
| methods |
| foo1 |
| reference: <testLibrary>::@class::A::@def::0::@method::foo1 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@method::foo1 |
| class A |
| reference: <testLibrary>::@class::A::@def::1 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A::@constructor::new |
| methods |
| foo2 |
| reference: <testLibrary>::@class::A::@def::1::@method::foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::A::@method::foo2 |
| foo3 |
| reference: <testLibrary>::@class::A::@def::1::@method::foo3 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@method::foo3 |
| '''); |
| } |
| |
| test_augmentationTarget_no2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| part 'b.dart'; |
| augment class A { |
| void foo1() {} |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'a.dart'; |
| augment class A { |
| void foo2() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class B {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class B @21 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| augment class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo1 @61 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo1 |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@method::foo2 |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| augment class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo2 @43 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@method::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class B @21 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new#element |
| typeName: A |
| methods |
| foo1 @61 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo1 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo1#element |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo2 @43 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@method::foo2 |
| element: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@method::foo2#element |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| methods |
| foo1 |
| reference: <testLibrary>::@class::A::@method::foo1 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo1 |
| foo2 |
| reference: <testLibrary>::@class::A::@method::foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@method::foo2 |
| '''); |
| } |
| |
| test_augmented_constructor_augment_field() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.foo(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 54 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_constructor_augment_getter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.foo(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| accessors |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 54 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| getters |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_constructor_augment_method() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.foo(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| methods |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 54 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_constructor_augment_setter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.foo(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo(int _) {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| accessors |
| set foo= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @39 |
| type: int |
| returnType: void |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| accessors |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 54 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@setter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| setters |
| set foo @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @39 |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::foo |
| setters |
| set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_constructors_add_named() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| A.named(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 42 |
| nameEnd: 48 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 41 |
| periodOffset: 42 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| named |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| '''); |
| } |
| |
| test_augmented_constructors_add_named_generic() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2> { |
| A.named(T2 a); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T1> {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T1 @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmented |
| constructors |
| ConstructorMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| augmentationSubstitution: {T2: T1} |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| named @47 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 46 |
| nameEnd: 52 |
| parameters |
| requiredPositional a @56 |
| type: T2 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T1 @23 |
| element: <not-implemented> |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| constructors |
| named @47 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 45 |
| periodOffset: 46 |
| formalParameters |
| a @56 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named::@parameter::a#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 |
| constructors |
| named |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| formalParameters |
| requiredPositional a |
| type: T2 |
| '''); |
| } |
| |
| test_augmented_constructors_add_named_hasUnnamed() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| A.named(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| @27 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 42 |
| nameEnd: 48 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 27 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 41 |
| periodOffset: 42 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| named |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| '''); |
| } |
| |
| test_augmented_constructors_add_unnamed() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| A(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 41 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| '''); |
| } |
| |
| test_augmented_constructors_add_unnamed_hasNamed() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| A(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.named(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 34 |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| <testLibraryFragment>::@class::A::@constructor::named |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 41 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| named |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::new |
| '''); |
| } |
| |
| test_augmented_constructors_add_useFieldFormal() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| A.named(this.f); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| final int f; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| final f @37 |
| reference: <testLibraryFragment>::@class::A::@field::f |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| accessors |
| synthetic get f @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::f |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::f |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| accessors |
| <testLibraryFragment>::@class::A::@getter::f |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 42 |
| nameEnd: 48 |
| parameters |
| requiredPositional final hasImplicitType this.f @54 |
| type: int |
| field: <testLibraryFragment>::@class::A::@field::f |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| f @37 |
| reference: <testLibraryFragment>::@class::A::@field::f |
| element: <testLibraryFragment>::@class::A::@field::f#element |
| getter2: <testLibraryFragment>::@class::A::@getter::f |
| getters |
| synthetic get f |
| reference: <testLibraryFragment>::@class::A::@getter::f |
| element: <testLibraryFragment>::@class::A::@getter::f#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| named @43 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 41 |
| periodOffset: 42 |
| formalParameters |
| this.f @54 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named::@parameter::f#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final f |
| firstFragment: <testLibraryFragment>::@class::A::@field::f |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::f#element |
| constructors |
| named |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| formalParameters |
| requiredPositional final hasImplicitType f |
| type: int |
| getters |
| synthetic get f |
| firstFragment: <testLibraryFragment>::@class::A::@getter::f |
| '''); |
| } |
| |
| test_augmented_constructors_add_useFieldInitializer() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| const A.named() : f = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| final int f; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| final f @37 |
| reference: <testLibraryFragment>::@class::A::@field::f |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| accessors |
| synthetic get f @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::f |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::f |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| accessors |
| <testLibraryFragment>::@class::A::@getter::f |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| const named @49 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 48 |
| nameEnd: 54 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: f @59 |
| staticElement: <testLibraryFragment>::@class::A::@field::f |
| element: <testLibraryFragment>::@class::A::@field::f#element |
| staticType: null |
| equals: = @61 |
| expression: IntegerLiteral |
| literal: 0 @63 |
| staticType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| f @37 |
| reference: <testLibraryFragment>::@class::A::@field::f |
| element: <testLibraryFragment>::@class::A::@field::f#element |
| getter2: <testLibraryFragment>::@class::A::@getter::f |
| getters |
| synthetic get f |
| reference: <testLibraryFragment>::@class::A::@getter::f |
| element: <testLibraryFragment>::@class::A::@getter::f#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named @49 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 47 |
| periodOffset: 48 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: f @59 |
| staticElement: <testLibraryFragment>::@class::A::@field::f |
| element: <testLibraryFragment>::@class::A::@field::f#element |
| staticType: null |
| equals: = @61 |
| expression: IntegerLiteral |
| literal: 0 @63 |
| staticType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final f |
| firstFragment: <testLibraryFragment>::@class::A::@field::f |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::f#element |
| constructors |
| const named |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructor::named |
| getters |
| synthetic get f |
| firstFragment: <testLibraryFragment>::@class::A::@getter::f |
| '''); |
| } |
| |
| test_augmented_field_augment_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.foo(); |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 32 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@constructor::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| element: <testLibraryFragment>::@class::A::@constructor::foo#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| type: int |
| constructors |
| foo |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::foo |
| '''); |
| } |
| |
| test_augmented_field_augment_field() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_field_augment_field2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_2 |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_field_augment_field_afterGetter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 1; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_field_augment_field_afterSetter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| previousFragment: <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_field_augment_field_augmentedInvocation() async { |
| // This is invalid code, but it should not crash. |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A {; |
| augment static const int foo = augmented(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| static const int foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| static const foo @44 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @50 |
| staticType: int |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic static get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment static const foo @67 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| AugmentedInvocation |
| augmentedKeyword: augmented @73 |
| arguments: ArgumentList |
| leftParenthesis: ( @82 |
| rightParenthesis: ) @83 |
| element: <null> |
| fragment: <null> |
| staticType: InvalidType |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @44 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @50 |
| staticType: int |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @67 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| initializer: expression_1 |
| AugmentedInvocation |
| augmentedKeyword: augmented @73 |
| arguments: ArgumentList |
| leftParenthesis: ( @82 |
| rightParenthesis: ) @83 |
| element: <null> |
| fragment: <null> |
| staticType: InvalidType |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| static const hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| constantInitializer |
| fragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| expression: expression_1 |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic static get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_field_augment_field_differentTypes() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment double foo = 1.2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @56 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: double |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @56 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_field_augment_field_plus() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment final int foo = augmented + 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| final int foo = 0; |
| const A(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| final foo @37 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @43 |
| staticType: int |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| const @54 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment final foo @59 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constantInitializer |
| BinaryExpression |
| leftOperand: AugmentedExpression |
| augmentedKeyword: augmented @65 |
| element: <testLibraryFragment>::@class::A::@field::foo |
| fragment: <testLibraryFragment>::@class::A::@field::foo |
| staticType: int |
| operator: + @75 |
| rightOperand: IntegerLiteral |
| literal: 1 @77 |
| staticType: int |
| staticElement: dart:core::<fragment>::@class::num::@method::+ |
| element: dart:core::<fragment>::@class::num::@method::+#element |
| staticInvokeType: num Function(num) |
| staticType: int |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @37 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 0 @43 |
| staticType: int |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| const new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 54 |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @59 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| initializer: expression_1 |
| BinaryExpression |
| leftOperand: AugmentedExpression |
| augmentedKeyword: augmented @65 |
| element: <testLibraryFragment>::@class::A::@field::foo |
| fragment: <testLibraryFragment>::@class::A::@field::foo |
| staticType: int |
| operator: + @75 |
| rightOperand: IntegerLiteral |
| literal: 1 @77 |
| staticType: int |
| staticElement: dart:core::<fragment>::@class::num::@method::+ |
| element: dart:core::<fragment>::@class::num::@method::+#element |
| staticInvokeType: num Function(num) |
| staticType: int |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| constantInitializer |
| fragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| expression: expression_1 |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| const new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| /// This is not allowed by the specification, but allowed syntactically, |
| /// so we need a way to handle it. |
| test_augmented_field_augment_getter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_field_augment_method() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| type: int |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| /// This is not allowed by the specification, but allowed syntactically, |
| /// so we need a way to handle it. |
| test_augmented_field_augment_setter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int foo = 1; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo(int _) {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| setter: setter_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| set foo= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @39 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| augment foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| augmentationTarget: <testLibraryFragment>::@class::A::@field::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| setters |
| set foo @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @39 |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| augment hasInitializer foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@fieldAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@field::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| setters |
| set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_fields_add() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| int foo2 = 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo1 = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo1 @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo1= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo1 @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo1 |
| <testLibraryFragment>::@class::A::@setter::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| foo2 @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_1 |
| getter: getter_1 |
| setter: setter_1 |
| accessors |
| synthetic get foo2 @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: field_1 |
| synthetic set foo2= @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _foo2 @-1 |
| type: int |
| returnType: void |
| id: setter_1 |
| variable: field_1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo1 @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo1 |
| setter2: <testLibraryFragment>::@class::A::@setter::foo1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| setters |
| synthetic set foo1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1#element |
| formalParameters |
| _foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1::@parameter::_foo1#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo2 @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| setter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| getters |
| synthetic get foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| setters |
| synthetic set foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| formalParameters |
| _foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2::@parameter::_foo2#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo1#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo1#element |
| hasInitializer foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| type: int |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| setter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| synthetic get foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| setters |
| synthetic set foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo1 |
| formalParameters |
| requiredPositional _foo1 |
| type: int |
| synthetic set foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| formalParameters |
| requiredPositional _foo2 |
| type: int |
| '''); |
| } |
| |
| test_augmented_fields_add_generic() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T1> { |
| T1 foo2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T1> { |
| T1 foo1; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T1 @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo1 @34 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: T1 |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: T1 |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo1= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo1 @-1 |
| type: T1 |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| FieldMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| augmentationSubstitution: {T1: T1} |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo1 |
| <testLibraryFragment>::@class::A::@setter::foo1 |
| GetterMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| augmentationSubstitution: {T1: T1} |
| SetterMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| augmentationSubstitution: {T1: T1} |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T1 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| foo2 @48 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: T1 |
| id: field_1 |
| getter: getter_1 |
| setter: setter_1 |
| accessors |
| synthetic get foo2 @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: T1 |
| id: getter_1 |
| variable: field_1 |
| synthetic set foo2= @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _foo2 @-1 |
| type: T1 |
| returnType: void |
| id: setter_1 |
| variable: field_1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T1 @23 |
| element: <not-implemented> |
| fields |
| foo1 @34 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo1 |
| setter2: <testLibraryFragment>::@class::A::@setter::foo1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| setters |
| synthetic set foo1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1#element |
| formalParameters |
| _foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1::@parameter::_foo1#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 @37 |
| element: <not-implemented> |
| fields |
| foo2 @48 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| setter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| getters |
| synthetic get foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| setters |
| synthetic set foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| formalParameters |
| _foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2::@parameter::_foo2#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 |
| fields |
| foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: T1 |
| getter: <testLibraryFragment>::@class::A::@getter::foo1#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo1#element |
| foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| type: T1 |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| setter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| synthetic get foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| setters |
| synthetic set foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo1 |
| formalParameters |
| requiredPositional _foo1 |
| type: T1 |
| synthetic set foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| formalParameters |
| requiredPositional _foo2 |
| type: T1 |
| '''); |
| } |
| |
| test_augmented_fields_add_useFieldFormal() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| final int foo; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A(this.foo); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| @27 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional final hasImplicitType this.foo @34 |
| type: int |
| field: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| final foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 27 |
| formalParameters |
| this.foo @34 |
| element: <testLibraryFragment>::@class::A::@constructor::new::@parameter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| formalParameters |
| requiredPositional final hasImplicitType foo |
| type: int |
| getters |
| synthetic get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_fields_add_useFieldInitializer() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| final int foo; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| const A() : foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const @33 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: foo @39 |
| staticElement: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| staticType: null |
| equals: = @43 |
| expression: IntegerLiteral |
| literal: 0 @45 |
| staticType: int |
| augmented |
| fields |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| final foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| const new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 33 |
| constantInitializers |
| ConstructorFieldInitializer |
| fieldName: SimpleIdentifier |
| token: foo @39 |
| staticElement: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| staticType: null |
| equals: = @43 |
| expression: IntegerLiteral |
| literal: 0 @45 |
| staticType: int |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| foo @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| getters |
| synthetic get foo |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| final foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo |
| type: int |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo#element |
| constructors |
| const new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_getter_augments_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.foo(); |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 32 |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::foo |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@constructor::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| element: <testLibraryFragment>::@class::A::@constructor::foo#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| foo |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::foo |
| getters |
| get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_getter_augments_method() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| methods |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_getter_augments_setter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo(int _) {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| set foo= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @39 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@setter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| setters |
| set foo @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @39 |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| setters |
| set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_getters_add() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| int get foo2 => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo1 => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo1 @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo2 @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| id: field_1 |
| getter: getter_1 |
| accessors |
| get foo2 @49 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: field_1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo1 @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| getters |
| get foo2 @49 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo1#element |
| synthetic foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| type: int |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| get foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| '''); |
| } |
| |
| test_augmented_getters_add_generic() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T1> { |
| T1 get foo2; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T1> { |
| T1 get foo1; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T1 @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: T1 |
| id: field_0 |
| getter: getter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| abstract get foo1 @38 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: T1 |
| id: getter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| FieldMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| augmentationSubstitution: {T1: T1} |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo1 |
| GetterMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| augmentationSubstitution: {T1: T1} |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T1 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo2 @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: T1 |
| id: field_1 |
| getter: getter_1 |
| accessors |
| abstract get foo2 @52 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: T1 |
| id: getter_1 |
| variable: field_1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T1 @23 |
| element: <not-implemented> |
| fields |
| synthetic foo1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo1 @38 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 @37 |
| element: <not-implemented> |
| fields |
| synthetic foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2#element |
| getter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| getters |
| get foo2 @52 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 |
| fields |
| synthetic foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: T1 |
| getter: <testLibraryFragment>::@class::A::@getter::foo1#element |
| synthetic foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| type: T1 |
| getter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| abstract get foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| abstract get foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getter::foo2 |
| '''); |
| } |
| |
| test_augmented_getters_augment_field() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_getters_augment_field2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| returnType: int |
| id: getter_2 |
| variable: <null> |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @46 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_getters_augment_getter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo1 => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo1 => 0; |
| int get foo2 => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| synthetic foo2 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo2 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_1 |
| getter: getter_1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo1 @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo1 |
| get foo2 @56 |
| reference: <testLibraryFragment>::@class::A::@getter::foo2 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_1 |
| variable: field_1 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| <testLibraryFragment>::@class::A::@field::foo2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo1 |
| <testLibraryFragment>::@class::A::@getter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo1 @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_2 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo1 |
| synthetic foo2 |
| reference: <testLibraryFragment>::@class::A::@field::foo2 |
| element: <testLibraryFragment>::@class::A::@field::foo2#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo2 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo1 @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo1 |
| get foo2 @56 |
| reference: <testLibraryFragment>::@class::A::@getter::foo2 |
| element: <testLibraryFragment>::@class::A::@getter::foo2#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo1 @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo1 |
| element: <testLibraryFragment>::@class::A::@getter::foo1#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo1#element |
| synthetic foo2 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo2 |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo2 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo2 |
| get foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo1 |
| '''); |
| } |
| |
| test_augmented_getters_augment_getter2_oneLib_oneTop() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::1 |
| augment get foo @85 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_2 |
| variable: <null> |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::1 |
| augment get foo @85 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::1 |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo::@def::0 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_getters_augment_getter2_twoLib() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo @50 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@getter::foo |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| returnType: int |
| id: getter_2 |
| variable: <null> |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo @50 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@getter::foo |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| '''); |
| } |
| |
| test_augmented_getters_augment_nothing() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment int get foo => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| configuration |
| ..withConstructors = false |
| ..withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmented |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: int |
| id: getter_0 |
| variable: <null> |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| getters |
| augment get foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| getters |
| get foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@getterAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_interfaces() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A implements I2 {} |
| class I2 {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A implements I1 {} |
| class I1 {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| interfaces |
| I1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| I1 |
| I2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class I1 @46 |
| reference: <testLibraryFragment>::@class::I1 |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| interfaces |
| I2 |
| class I2 @60 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class I1 @46 |
| reference: <testLibraryFragment>::@class::I1 |
| element: <testLibrary>::@class::I1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| element: <testLibraryFragment>::@class::I1::@constructor::new#element |
| typeName: I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| class I2 @60 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| element: <testLibrary>::@class::I2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new#element |
| typeName: I2 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| interfaces |
| I1 |
| I2 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class I1 |
| reference: <testLibrary>::@class::I1 |
| firstFragment: <testLibraryFragment>::@class::I1 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::I1::@constructor::new |
| class I2 |
| reference: <testLibrary>::@class::I2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| '''); |
| } |
| |
| test_augmented_interfaces_chain() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| part 'b.dart'; |
| augment class A implements I2 {} |
| class I2 {} |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'a.dart'; |
| augment class A implements I3 {} |
| class I3 {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A implements I1 {} |
| class I1 {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| interfaces |
| I1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| I1 |
| I2 |
| I3 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class I1 @46 |
| reference: <testLibraryFragment>::@class::I1 |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| augment class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| interfaces |
| I2 |
| class I2 @75 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| augment class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| interfaces |
| I3 |
| class I3 @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@class::I3 |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@class::I3::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@class::I3 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class I1 @46 |
| reference: <testLibraryFragment>::@class::I1 |
| element: <testLibrary>::@class::I1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| element: <testLibraryFragment>::@class::I1::@constructor::new#element |
| typeName: I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| class I2 @75 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| element: <testLibrary>::@class::I2 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new#element |
| typeName: I2 |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| class I3 @57 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@class::I3 |
| element: <testLibrary>::@class::I3 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/b.dart::@class::I3::@constructor::new |
| element: <testLibrary>::@fragment::package:test/b.dart::@class::I3::@constructor::new#element |
| typeName: I3 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| interfaces |
| I1 |
| I2 |
| I3 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class I1 |
| reference: <testLibrary>::@class::I1 |
| firstFragment: <testLibraryFragment>::@class::I1 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::I1::@constructor::new |
| class I2 |
| reference: <testLibrary>::@class::I2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| class I3 |
| reference: <testLibrary>::@class::I3 |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@class::I3 |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@class::I3::@constructor::new |
| '''); |
| } |
| |
| test_augmented_interfaces_generic() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2> implements I2<T2> {} |
| class I2<E> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T> implements I1 {} |
| class I1 {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| interfaces |
| I1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| I1 |
| I2<T> |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class I1 @49 |
| reference: <testLibraryFragment>::@class::I1 |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| interfaces |
| I2<T2> |
| class I2 @68 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant E @71 |
| defaultType: dynamic |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class I1 @49 |
| reference: <testLibraryFragment>::@class::I1 |
| element: <testLibrary>::@class::I1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| element: <testLibraryFragment>::@class::I1::@constructor::new#element |
| typeName: I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| class I2 @68 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| element: <testLibrary>::@class::I2 |
| typeParameters |
| E @71 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new#element |
| typeName: I2 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| interfaces |
| I1 |
| I2<T> |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class I1 |
| reference: <testLibrary>::@class::I1 |
| firstFragment: <testLibraryFragment>::@class::I1 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::I1::@constructor::new |
| class I2 |
| reference: <testLibrary>::@class::I2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| typeParameters |
| E |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| '''); |
| } |
| |
| test_augmented_interfaces_generic_mismatch() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2, T3> implements I2<T2> {} |
| class I2<E> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T> implements I1 {} |
| class I1 {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| interfaces |
| I1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| I1 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class I1 @49 |
| reference: <testLibraryFragment>::@class::I1 |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| covariant T3 @41 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| interfaces |
| I2<T2> |
| class I2 @72 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant E @75 |
| defaultType: dynamic |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class I1 @49 |
| reference: <testLibraryFragment>::@class::I1 |
| element: <testLibrary>::@class::I1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::I1::@constructor::new |
| element: <testLibraryFragment>::@class::I1::@constructor::new#element |
| typeName: I1 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| T3 @41 |
| element: <not-implemented> |
| class I2 @72 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| element: <testLibrary>::@class::I2 |
| typeParameters |
| E @75 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| element: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new#element |
| typeName: I2 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| interfaces |
| I1 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class I1 |
| reference: <testLibrary>::@class::I1 |
| firstFragment: <testLibraryFragment>::@class::I1 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::I1::@constructor::new |
| class I2 |
| reference: <testLibrary>::@class::I2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2 |
| typeParameters |
| E |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@class::I2::@constructor::new |
| '''); |
| } |
| |
| test_augmented_method_augments_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.foo(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 32 |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::foo |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@constructor::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| element: <testLibraryFragment>::@class::A::@constructor::foo#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| foo |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::foo |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_method_augments_field() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibraryFragment>::@class::A::@setter::foo |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_method_augments_getter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_method_augments_setter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo(int _) {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| set foo= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @39 |
| type: int |
| returnType: void |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@setter::foo |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@setter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| setters |
| set foo @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @39 |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| setters |
| set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| '''); |
| } |
| |
| test_augmented_methods() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| void bar() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| bar @46 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| bar @46 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| bar |
| reference: <testLibrary>::@class::A::@method::bar |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| '''); |
| } |
| |
| test_augmented_methods_add_withDefaultValue() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| void foo([int x = 42]) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| foo @46 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| optionalPositional default x @55 |
| type: int |
| constantInitializer |
| IntegerLiteral |
| literal: 42 @59 |
| staticType: int |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| foo @46 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo#element |
| formalParameters |
| default x @55 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo::@parameter::x#element |
| initializer: expression_0 |
| IntegerLiteral |
| literal: 42 @59 |
| staticType: int |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::foo |
| formalParameters |
| optionalPositional x |
| type: int |
| constantInitializer |
| expression: expression_0 |
| '''); |
| } |
| |
| test_augmented_methods_augment() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo1() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo1() {} |
| void foo2() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo1 @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo1 |
| foo2 @49 |
| reference: <testLibraryFragment>::@class::A::@method::foo2 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo1 |
| <testLibraryFragment>::@class::A::@method::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo1 @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo1 @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo1 |
| element: <testLibraryFragment>::@class::A::@method::foo1#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo1 |
| foo2 @49 |
| reference: <testLibraryFragment>::@class::A::@method::foo2 |
| element: <testLibraryFragment>::@class::A::@method::foo2#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo1 @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo1 |
| element: <testLibraryFragment>::@class::A::@method::foo1#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo1 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo1 |
| reference: <testLibrary>::@class::A::@method::foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo1 |
| foo2 |
| reference: <testLibrary>::@class::A::@method::foo2 |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo2 |
| '''); |
| } |
| |
| test_augmented_methods_augment2_oneLib_oneTop() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::1 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::1 |
| augment foo @78 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::1 |
| augment foo @78 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::1 |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo::@def::0 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_methods_augment2_oneLib_twoTop() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| returnType: void |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@methodAugmentation::foo |
| augment class A @79 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| methods |
| augment foo @98 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| returnType: void |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| methods |
| augment foo @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@methodAugmentation::foo |
| class A @79 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1 |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0 |
| methods |
| augment foo @98 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::1::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@def::0::@methodAugmentation::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_methods_augment2_twoLib() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| part 'b.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'a.dart'; |
| augment class A { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| augment class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| methods |
| augment foo @69 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| augment class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @50 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| methods |
| augment foo @69 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibrary>::@fragment::package:test/a.dart |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @32 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| augment foo @51 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_methods_generic() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2> { |
| T2 bar() => throw 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T> { |
| T foo() => throw 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: T |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| MethodMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| augmentationSubstitution: {T2: T} |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| bar @48 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: T2 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| methods |
| bar @48 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| bar |
| reference: <testLibrary>::@class::A::@method::bar |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@method::bar |
| '''); |
| } |
| |
| test_augmented_methods_generic_augment() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2> { |
| augment T2 foo() => throw 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T> { |
| T foo() => throw 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: T |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| MethodMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| augmentationSubstitution: {T2: T} |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @56 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: T2 |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| methods |
| augment foo @56 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_mixins() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A with M2 {} |
| mixin M2 {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A with M1 {} |
| mixin M1 {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| supertype: Object |
| mixins |
| M1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| mixins |
| M1 |
| M2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin M1 @40 |
| reference: <testLibraryFragment>::@mixin::M1 |
| enclosingElement3: <testLibraryFragment> |
| superclassConstraints |
| Object |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| mixins |
| M2 |
| mixins |
| mixin M2 @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| superclassConstraints |
| Object |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| mixins |
| mixin M1 @40 |
| reference: <testLibraryFragment>::@mixin::M1 |
| element: <testLibrary>::@mixin::M1 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| mixins |
| mixin M2 @54 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| element: <testLibrary>::@mixin::M2 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| supertype: Object |
| mixins |
| M1 |
| M2 |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin M1 |
| reference: <testLibrary>::@mixin::M1 |
| firstFragment: <testLibraryFragment>::@mixin::M1 |
| superclassConstraints |
| Object |
| mixin M2 |
| reference: <testLibrary>::@mixin::M2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_augmented_mixins_inferredTypeArguments() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T2> with M2 {} |
| mixin M2<U2> on M1<U2> {} |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A<T3> with M3 {} |
| mixin M3<U3> on M2<U3> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class B<S> {} |
| class A<T1> extends B<T1> with M1 {} |
| mixin M1<U1> on B<U1> {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @36 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant S @38 |
| defaultType: dynamic |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| class A @50 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T1 @52 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| supertype: B<T1> |
| mixins |
| M1<T1> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| superConstructor: ConstructorMember |
| base: <testLibraryFragment>::@class::B::@constructor::new |
| substitution: {S: T1} |
| augmented |
| mixins |
| M1<T1> |
| M2<T1> |
| M3<T1> |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin M1 @87 |
| reference: <testLibraryFragment>::@mixin::M1 |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant U1 @90 |
| defaultType: dynamic |
| superclassConstraints |
| B<U1> |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| mixins |
| M2<T2> |
| mixins |
| mixin M2 @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant U2 @61 |
| defaultType: dynamic |
| superclassConstraints |
| M1<U2> |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| typeParameters |
| covariant T3 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| mixins |
| M3<T3> |
| mixins |
| mixin M3 @58 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@mixin::M3 |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| typeParameters |
| covariant U3 @61 |
| defaultType: dynamic |
| superclassConstraints |
| M2<U3> |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class B @36 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| typeParameters |
| S @38 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| class A @50 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T1 @52 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| superConstructor: ConstructorMember |
| base: <testLibraryFragment>::@class::B::@constructor::new |
| substitution: {S: T1} |
| mixins |
| mixin M1 @87 |
| reference: <testLibraryFragment>::@mixin::M1 |
| element: <testLibrary>::@mixin::M1 |
| typeParameters |
| U1 @90 |
| element: <not-implemented> |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| mixins |
| mixin M2 @58 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| element: <testLibrary>::@mixin::M2 |
| typeParameters |
| U2 @61 |
| element: <not-implemented> |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T3 @37 |
| element: <not-implemented> |
| mixins |
| mixin M3 @58 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@mixin::M3 |
| element: <testLibrary>::@mixin::M3 |
| typeParameters |
| U3 @61 |
| element: <not-implemented> |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| typeParameters |
| S |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T1 |
| supertype: B<T1> |
| mixins |
| M1<T1> |
| M2<T1> |
| M3<T1> |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::B::@constructor::new#element |
| mixins |
| mixin M1 |
| reference: <testLibrary>::@mixin::M1 |
| firstFragment: <testLibraryFragment>::@mixin::M1 |
| typeParameters |
| U1 |
| superclassConstraints |
| B<U1> |
| mixin M2 |
| reference: <testLibrary>::@mixin::M2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@mixin::M2 |
| typeParameters |
| U2 |
| superclassConstraints |
| M1<U2> |
| mixin M3 |
| reference: <testLibrary>::@mixin::M3 |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@mixin::M3 |
| typeParameters |
| U3 |
| superclassConstraints |
| M2<U3> |
| '''); |
| } |
| |
| test_augmented_setter_augments_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.foo(); |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 32 |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::foo |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@constructor::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| foo @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::foo |
| element: <testLibraryFragment>::@class::A::@constructor::foo#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| foo |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::foo |
| setters |
| set foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_setter_augments_getter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int get foo => 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| getter: getter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@getter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| get foo @35 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| set foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_setter_augments_method() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| methods |
| <testLibraryFragment>::@class::A::@method::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: <null> |
| augmentationTargetAny: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| setters |
| set foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| '''); |
| } |
| |
| test_augmented_setters_add() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| set foo2(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo1(int _) {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| set foo1= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @40 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@setter::foo1 |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo2 @-1 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| type: int |
| id: field_1 |
| setter: setter_1 |
| accessors |
| set foo2= @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @54 |
| type: int |
| returnType: void |
| id: setter_1 |
| variable: field_1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo1 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| setters |
| set foo1 @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1#element |
| formalParameters |
| _ @40 |
| element: <testLibraryFragment>::@class::A::@setter::foo1::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo2 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2#element |
| setter2: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| setters |
| set foo2 @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| formalParameters |
| _ @54 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2::@parameter::_#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo1#element |
| synthetic foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@field::foo2 |
| type: int |
| setter: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| setters |
| set foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo1 |
| formalParameters |
| requiredPositional _ |
| type: int |
| set foo2 |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setter::foo2 |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_setters_augment_field() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| int foo = 0; |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| shouldUseTypeForInitializerInference: true |
| id: field_0 |
| getter: getter_0 |
| setter: setter_0 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| synthetic get foo @-1 |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: int |
| id: getter_0 |
| variable: field_0 |
| synthetic set foo= @-1 |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _foo @-1 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibraryFragment>::@class::A::@getter::foo |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_1 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@setter::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| hasInitializer foo @31 |
| reference: <testLibraryFragment>::@class::A::@field::foo |
| element: <testLibraryFragment>::@class::A::@field::foo#element |
| getter2: <testLibraryFragment>::@class::A::@getter::foo |
| setter2: <testLibraryFragment>::@class::A::@setter::foo |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| getters |
| synthetic get foo |
| reference: <testLibraryFragment>::@class::A::@getter::foo |
| element: <testLibraryFragment>::@class::A::@getter::foo#element |
| setters |
| synthetic set foo |
| reference: <testLibraryFragment>::@class::A::@setter::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _foo |
| element: <testLibraryFragment>::@class::A::@setter::foo::@parameter::_foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@setter::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| previousFragment: <testLibraryFragment>::@class::A::@setter::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| hasInitializer foo |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo |
| type: int |
| getter: <testLibraryFragment>::@class::A::@getter::foo#element |
| setter: <testLibraryFragment>::@class::A::@setter::foo#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| getters |
| synthetic get foo |
| firstFragment: <testLibraryFragment>::@class::A::@getter::foo |
| setters |
| synthetic set foo |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo |
| formalParameters |
| requiredPositional _foo |
| type: int |
| '''); |
| } |
| |
| test_augmented_setters_augment_nothing() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A {} |
| '''); |
| |
| configuration |
| ..withConstructors = false |
| ..withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmented |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: <null> |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo#element |
| formalParameters |
| _ @61 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo::@parameter::_#element |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| setters |
| set foo |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmented_setters_augment_setter() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment set foo1(int _) {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| set foo1(int _) {} |
| set foo2(int _) {} |
| } |
| '''); |
| |
| configuration.withPropertyLinking = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_0 |
| setter: setter_0 |
| synthetic foo2 @-1 |
| reference: <testLibraryFragment>::@class::A::@field::foo2 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| type: int |
| id: field_1 |
| setter: setter_1 |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| accessors |
| set foo1= @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @40 |
| type: int |
| returnType: void |
| id: setter_0 |
| variable: field_0 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1 |
| set foo2= @52 |
| reference: <testLibraryFragment>::@class::A::@setter::foo2 |
| enclosingElement3: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @61 |
| type: int |
| returnType: void |
| id: setter_1 |
| variable: field_1 |
| augmented |
| fields |
| <testLibraryFragment>::@class::A::@field::foo1 |
| <testLibraryFragment>::@class::A::@field::foo2 |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| accessors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1 |
| <testLibraryFragment>::@class::A::@setter::foo2 |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| accessors |
| augment set foo1= @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1 |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| parameters |
| requiredPositional _ @62 |
| type: int |
| returnType: void |
| id: setter_2 |
| variable: <null> |
| augmentationTarget: <testLibraryFragment>::@class::A::@setter::foo1 |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| fields |
| synthetic foo1 |
| reference: <testLibraryFragment>::@class::A::@field::foo1 |
| element: <testLibraryFragment>::@class::A::@field::foo1#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo1 |
| synthetic foo2 |
| reference: <testLibraryFragment>::@class::A::@field::foo2 |
| element: <testLibraryFragment>::@class::A::@field::foo2#element |
| setter2: <testLibraryFragment>::@class::A::@setter::foo2 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| setters |
| set foo1 @31 |
| reference: <testLibraryFragment>::@class::A::@setter::foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1#element |
| formalParameters |
| _ @40 |
| element: <testLibraryFragment>::@class::A::@setter::foo1::@parameter::_#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1 |
| set foo2 @52 |
| reference: <testLibraryFragment>::@class::A::@setter::foo2 |
| element: <testLibraryFragment>::@class::A::@setter::foo2#element |
| formalParameters |
| _ @61 |
| element: <testLibraryFragment>::@class::A::@setter::foo2::@parameter::_#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| setters |
| augment set foo1 @53 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1 |
| element: <testLibraryFragment>::@class::A::@setter::foo1#element |
| formalParameters |
| _ @62 |
| element: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@setterAugmentation::foo1::@parameter::_#element |
| previousFragment: <testLibraryFragment>::@class::A::@setter::foo1 |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| fields |
| synthetic foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo1 |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo1#element |
| synthetic foo2 |
| firstFragment: <testLibraryFragment>::@class::A::@field::foo2 |
| type: int |
| setter: <testLibraryFragment>::@class::A::@setter::foo2#element |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| setters |
| set foo2 |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo2 |
| formalParameters |
| requiredPositional _ |
| type: int |
| set foo1 |
| firstFragment: <testLibraryFragment>::@class::A::@setter::foo1 |
| formalParameters |
| requiredPositional _ |
| type: int |
| '''); |
| } |
| |
| test_augmentedBy_mixin2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| |
| augment mixin A {} |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| |
| augment mixin A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @37 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| mixins |
| augment mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTargetAny: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@mixinAugmentation::A |
| superclassConstraints |
| Object |
| augmented |
| superclassConstraints |
| Object |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| mixins |
| augment mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@mixinAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @37 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| mixins |
| mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| element: <testLibrary>::@mixin::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@mixinAugmentation::A |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| mixins |
| mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@mixinAugmentation::A |
| element: <testLibrary>::@mixin::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin A |
| reference: <testLibrary>::@mixin::A |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| /// Invalid augmentation of class with mixin does not "own" the name. |
| /// When a valid class augmentation follows, it can use the name. |
| test_augmentedBy_mixin_class() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| |
| augment mixin A {} |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| |
| augment class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| |
| class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @37 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| mixins |
| augment mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTargetAny: <testLibraryFragment>::@class::A |
| superclassConstraints |
| Object |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @36 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTargetAny: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructor::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @37 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A::@def::0 |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| mixins |
| mixin A @36 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| element: <testLibrary>::@mixin::A |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A::@def::1 |
| constructors |
| synthetic new |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructor::new |
| element: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructor::new#element |
| typeName: A |
| classes |
| class A |
| reference: <testLibrary>::@class::A::@def::0 |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class A |
| reference: <testLibrary>::@class::A::@def::1 |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructor::new |
| mixins |
| mixin A |
| reference: <testLibrary>::@mixin::A |
| firstFragment: <testLibrary>::@fragment::package:test/a.dart::@mixinAugmentation::A |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_constructors_augment2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.named(); |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.named(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A { |
| A.named(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @44 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 43 |
| nameEnd: 49 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructorAugmentation::named |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 56 |
| augmentationTarget: <testLibraryFragment>::@class::A::@constructor::named |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructorAugmentation::named |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructorAugmentation::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 56 |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @44 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 42 |
| periodOffset: 43 |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructorAugmentation::named |
| previousFragment: <testLibraryFragment>::@class::A::@constructor::named |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::A::@constructorAugmentation::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| named |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| '''); |
| } |
| |
| test_constructors_augment_named() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A.named(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A.named(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement3: <testLibraryFragment>::@class::A |
| periodOffset: 28 |
| nameEnd: 34 |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| periodOffset: 50 |
| nameEnd: 56 |
| augmentationTarget: <testLibraryFragment>::@class::A::@constructor::named |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| named @29 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 27 |
| periodOffset: 28 |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment named @51 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::named |
| element: <testLibraryFragment>::@class::A::@constructor::named#element |
| typeName: A |
| typeNameOffset: 49 |
| periodOffset: 50 |
| previousFragment: <testLibraryFragment>::@class::A::@constructor::named |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| named |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| '''); |
| } |
| |
| test_constructors_augment_unnamed() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A { |
| augment A(); |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| A(); |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| @27 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::new |
| augmented |
| constructors |
| <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| constructors |
| augment @49 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::new |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| augmentationTarget: <testLibraryFragment>::@class::A::@constructor::new |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 27 |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::new |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| constructors |
| augment new |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@constructorAugmentation::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| typeNameOffset: 49 |
| previousFragment: <testLibraryFragment>::@class::A::@constructor::new |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_inferTypes_method_ofAugment() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class A { |
| int foo(String a) => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class B { |
| foo(a) => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| import 'a.dart'; |
| part 'b.dart'; |
| |
| class B extends A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| libraryImports |
| package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_0 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @39 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| supertype: A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new |
| augmented |
| constructors |
| <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class B @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibraryFragment>::@class::B |
| methods |
| foo @41 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| parameters |
| requiredPositional hasImplicitType a @45 |
| type: String |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| libraryImports |
| package:test/a.dart |
| classes |
| class B @39 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class B @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| element: <testLibrary>::@class::B |
| previousFragment: <testLibraryFragment>::@class::B |
| methods |
| foo @41 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo |
| element: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo#element |
| formalParameters |
| a @45 |
| element: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo::@parameter::a#element |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| supertype: A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new#element |
| methods |
| foo |
| reference: <testLibrary>::@class::B::@method::foo |
| firstFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@method::foo |
| formalParameters |
| requiredPositional hasImplicitType a |
| type: String |
| '''); |
| } |
| |
| test_inferTypes_method_usingAugmentation_interface() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class A { |
| int foo(String a) => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| import 'a.dart'; |
| augment class B implements A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'b.dart'; |
| |
| class B { |
| foo(a) => 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @22 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| methods |
| foo @28 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::B |
| parameters |
| requiredPositional hasImplicitType a @32 |
| type: String |
| returnType: int |
| augmented |
| interfaces |
| A |
| constructors |
| <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| <testLibraryFragment>::@class::B::@method::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| augment class B @52 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibraryFragment>::@class::B |
| interfaces |
| A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @22 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| methods |
| foo @28 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| element: <testLibraryFragment>::@class::B::@method::foo#element |
| formalParameters |
| a @32 |
| element: <testLibraryFragment>::@class::B::@method::foo::@parameter::a#element |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| classes |
| class B @52 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| element: <testLibrary>::@class::B |
| previousFragment: <testLibraryFragment>::@class::B |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| interfaces |
| A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::B::@method::foo |
| firstFragment: <testLibraryFragment>::@class::B::@method::foo |
| formalParameters |
| requiredPositional hasImplicitType a |
| type: String |
| '''); |
| } |
| |
| test_inferTypes_method_usingAugmentation_mixin() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| mixin A { |
| int foo(String a) => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| import 'a.dart'; |
| augment class B with A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'b.dart'; |
| |
| class B { |
| foo(a) => 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @22 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| methods |
| foo @28 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::B |
| parameters |
| requiredPositional hasImplicitType a @32 |
| type: String |
| returnType: int |
| augmented |
| mixins |
| A |
| constructors |
| <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| <testLibraryFragment>::@class::B::@method::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| augment class B @52 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibraryFragment>::@class::B |
| mixins |
| A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @22 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| methods |
| foo @28 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| element: <testLibraryFragment>::@class::B::@method::foo#element |
| formalParameters |
| a @32 |
| element: <testLibraryFragment>::@class::B::@method::foo::@parameter::a#element |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| classes |
| class B @52 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| element: <testLibrary>::@class::B |
| previousFragment: <testLibraryFragment>::@class::B |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| supertype: Object |
| mixins |
| A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| foo |
| reference: <testLibrary>::@class::B::@method::foo |
| firstFragment: <testLibraryFragment>::@class::B::@method::foo |
| formalParameters |
| requiredPositional hasImplicitType a |
| type: String |
| '''); |
| } |
| |
| test_inferTypes_method_withAugment() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class A { |
| int foo(String a) => 0; |
| } |
| '''); |
| |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class B { |
| augment foo(a) => 0; |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| import 'a.dart'; |
| part 'b.dart'; |
| |
| class B extends A { |
| foo(a) => 0; |
| } |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| libraryImports |
| package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| parts |
| part_0 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class B @39 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| supertype: A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new |
| methods |
| foo @55 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::B |
| parameters |
| requiredPositional hasImplicitType a @59 |
| type: String |
| returnType: int |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo |
| augmented |
| constructors |
| <testLibraryFragment>::@class::B::@constructor::new |
| methods |
| <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class B @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibraryFragment>::@class::B |
| methods |
| augment foo @49 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| parameters |
| requiredPositional hasImplicitType a @53 |
| type: String |
| returnType: int |
| augmentationTarget: <testLibraryFragment>::@class::B::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| libraryImports |
| package:test/a.dart |
| classes |
| class B @39 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new |
| methods |
| foo @55 |
| reference: <testLibraryFragment>::@class::B::@method::foo |
| element: <testLibraryFragment>::@class::B::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo |
| formalParameters |
| a @59 |
| element: <testLibraryFragment>::@class::B::@method::foo::@parameter::a#element |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class B @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B |
| element: <testLibrary>::@class::B |
| previousFragment: <testLibraryFragment>::@class::B |
| methods |
| augment foo @49 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::B::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::B::@method::foo |
| formalParameters |
| a @53 |
| element: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::B::@methodAugmentation::foo::@parameter::a#element |
| classes |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| supertype: A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| superConstructor: package:test/a.dart::<fragment>::@class::A::@constructor::new#element |
| methods |
| foo |
| reference: <testLibrary>::@class::B::@method::foo |
| firstFragment: <testLibraryFragment>::@class::B::@method::foo |
| formalParameters |
| requiredPositional hasImplicitType a |
| type: String |
| '''); |
| } |
| |
| test_methods_typeParameterCountMismatch() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T> { |
| augment void foo() {} |
| } |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A { |
| void foo() {} |
| void bar() {} |
| } |
| '''); |
| |
| configuration.withConstructors = false; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| bar @48 |
| reference: <testLibraryFragment>::@class::A::@method::bar |
| enclosingElement3: <testLibraryFragment>::@class::A |
| returnType: void |
| augmented |
| methods |
| <testLibraryFragment>::@class::A::@method::bar |
| MethodMember |
| base: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| augmentationSubstitution: {T: InvalidType} |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| methods |
| augment foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| returnType: void |
| augmentationTarget: <testLibraryFragment>::@class::A::@method::foo |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| methods |
| foo @32 |
| reference: <testLibraryFragment>::@class::A::@method::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| bar @48 |
| reference: <testLibraryFragment>::@class::A::@method::bar |
| element: <testLibraryFragment>::@class::A::@method::bar#element |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T @37 |
| element: <not-implemented> |
| methods |
| augment foo @57 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A::@methodAugmentation::foo |
| element: <testLibraryFragment>::@class::A::@method::foo#element |
| previousFragment: <testLibraryFragment>::@class::A::@method::foo |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| methods |
| foo |
| reference: <testLibrary>::@class::A::@method::foo |
| firstFragment: <testLibraryFragment>::@class::A::@method::foo |
| bar |
| reference: <testLibrary>::@class::A::@method::bar |
| firstFragment: <testLibraryFragment>::@class::A::@method::bar |
| '''); |
| } |
| |
| test_modifiers_abstract() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment abstract class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| abstract class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| abstract class A @30 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment abstract class A @44 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @30 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @44 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| abstract class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_modifiers_base() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment base class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| base class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| base class A @26 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment base class A @40 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @26 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @40 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| base class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_modifiers_final() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment final class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| final class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| final class A @27 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment final class A @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @27 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| final class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_modifiers_interface() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment interface class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| interface class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| interface class A @31 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment interface class A @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @31 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @45 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| interface class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_modifiers_mixin() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment mixin class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| mixin class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| mixin class A @27 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment mixin class A @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @27 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @41 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| mixin class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_modifiers_sealed() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment sealed class A {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| sealed class A {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| abstract sealed class A @28 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment abstract sealed class A @42 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @28 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @42 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| classes |
| abstract sealed class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_notAugmented_interfaces() async { |
| var library = await buildLibrary(r''' |
| class A implements I {} |
| class I {} |
| '''); |
| |
| configuration.withAugmentedWithoutAugmentation = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| interfaces |
| I |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| I |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class I @30 |
| reference: <testLibraryFragment>::@class::I |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::I::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::I |
| augmented |
| constructors |
| <testLibraryFragment>::@class::I::@constructor::new |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class I @30 |
| reference: <testLibraryFragment>::@class::I |
| element: <testLibrary>::@class::I |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::I::@constructor::new |
| element: <testLibraryFragment>::@class::I::@constructor::new#element |
| typeName: I |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| interfaces |
| I |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class I |
| reference: <testLibrary>::@class::I |
| firstFragment: <testLibraryFragment>::@class::I |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::I::@constructor::new |
| '''); |
| } |
| |
| test_notAugmented_mixins() async { |
| var library = await buildLibrary(r''' |
| class A implements M {} |
| mixin M {} |
| '''); |
| |
| configuration.withAugmentedWithoutAugmentation = true; |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| interfaces |
| M |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| interfaces |
| M |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin M @30 |
| reference: <testLibraryFragment>::@mixin::M |
| enclosingElement3: <testLibraryFragment> |
| superclassConstraints |
| Object |
| augmented |
| superclassConstraints |
| Object |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| mixins |
| mixin M @30 |
| reference: <testLibraryFragment>::@mixin::M |
| element: <testLibrary>::@mixin::M |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| interfaces |
| M |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| mixins |
| mixin M |
| reference: <testLibrary>::@mixin::M |
| firstFragment: <testLibraryFragment>::@mixin::M |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_notSimplyBounded_self() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T extends A> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T extends A> {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| notSimplyBounded class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| bound: A<dynamic> |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T @37 |
| bound: A<dynamic> |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T @37 |
| element: <not-implemented> |
| classes |
| notSimplyBounded class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| bound: A<dynamic> |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_supertype_fromAugmentation() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class B<T2> extends A<T2> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T> {} |
| class B<T1> {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| defaultType: dynamic |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| class B @35 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T1 @37 |
| defaultType: dynamic |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::B |
| supertype: A<T1> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| superConstructor: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::new |
| substitution: {T: T1} |
| augmented |
| constructors |
| <testLibraryFragment>::@class::B::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class B @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::B |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T2 @37 |
| defaultType: dynamic |
| augmentationTarget: <testLibraryFragment>::@class::B |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class B @35 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::B |
| typeParameters |
| T1 @37 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| superConstructor: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::new |
| substitution: {T: T1} |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class B @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::B |
| element: <testLibrary>::@class::B |
| previousFragment: <testLibraryFragment>::@class::B |
| typeParameters |
| T2 @37 |
| element: <not-implemented> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| typeParameters |
| T1 |
| supertype: A<T1> |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new#element |
| '''); |
| } |
| |
| test_supertype_fromAugmentation2() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class C extends A {} |
| '''); |
| |
| // `extends B` should be ignored, we already have `extends A` |
| newFile('$testPackageLibPath/b.dart', r''' |
| part of 'test.dart'; |
| augment class C extends B {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| part 'b.dart'; |
| class A {} |
| class B {} |
| class C {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| part_1 |
| uri: package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| class B @47 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| class C @58 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement3: <testLibraryFragment> |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| supertype: A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::C |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new |
| augmented |
| constructors |
| <testLibraryFragment>::@class::C::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class C @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| augmentationTarget: <testLibraryFragment>::@class::C |
| augmentation: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::C |
| <testLibrary>::@fragment::package:test/b.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class C @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::C |
| enclosingElement3: <testLibrary>::@fragment::package:test/b.dart |
| augmentationTarget: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @36 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class B @47 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| class C @58 |
| reference: <testLibraryFragment>::@class::C |
| element: <testLibrary>::@class::C |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| element: <testLibraryFragment>::@class::C::@constructor::new#element |
| typeName: C |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart |
| classes |
| class C @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| element: <testLibrary>::@class::C |
| previousFragment: <testLibraryFragment>::@class::C |
| nextFragment: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::C |
| <testLibrary>::@fragment::package:test/b.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class C @35 |
| reference: <testLibrary>::@fragment::package:test/b.dart::@classAugmentation::C |
| element: <testLibrary>::@class::C |
| previousFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::C |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| class C |
| reference: <testLibrary>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C |
| supertype: A |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new#element |
| '''); |
| } |
| |
| test_typeParameters_defaultType() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| part of 'test.dart'; |
| augment class A<T extends B> {} |
| '''); |
| |
| var library = await buildLibrary(r''' |
| part 'a.dart'; |
| class A<T extends B> {} |
| class B {} |
| '''); |
| |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement3: <null> |
| parts |
| part_0 |
| uri: package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| unit: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement3: <testLibraryFragment> |
| typeParameters |
| covariant T @23 |
| bound: B |
| defaultType: B |
| augmentation: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::A |
| augmented |
| constructors |
| <testLibraryFragment>::@class::A::@constructor::new |
| class B @45 |
| reference: <testLibraryFragment>::@class::B |
| enclosingElement3: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| enclosingElement3: <testLibraryFragment>::@class::B |
| <testLibrary>::@fragment::package:test/a.dart |
| enclosingElement3: <testLibraryFragment> |
| classes |
| augment class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| enclosingElement3: <testLibrary>::@fragment::package:test/a.dart |
| typeParameters |
| covariant T @37 |
| bound: B |
| defaultType: B |
| augmentationTarget: <testLibraryFragment>::@class::A |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| element: <testLibrary> |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart |
| classes |
| class A @21 |
| reference: <testLibraryFragment>::@class::A |
| element: <testLibrary>::@class::A |
| nextFragment: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| typeParameters |
| T @23 |
| element: <not-implemented> |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| element: <testLibraryFragment>::@class::A::@constructor::new#element |
| typeName: A |
| class B @45 |
| reference: <testLibraryFragment>::@class::B |
| element: <testLibrary>::@class::B |
| constructors |
| synthetic new |
| reference: <testLibraryFragment>::@class::B::@constructor::new |
| element: <testLibraryFragment>::@class::B::@constructor::new#element |
| typeName: B |
| <testLibrary>::@fragment::package:test/a.dart |
| element: <testLibrary> |
| enclosingFragment: <testLibraryFragment> |
| previousFragment: <testLibraryFragment> |
| classes |
| class A @35 |
| reference: <testLibrary>::@fragment::package:test/a.dart::@classAugmentation::A |
| element: <testLibrary>::@class::A |
| previousFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T @37 |
| element: <not-implemented> |
| classes |
| class A |
| reference: <testLibrary>::@class::A |
| firstFragment: <testLibraryFragment>::@class::A |
| typeParameters |
| T |
| bound: B |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class B |
| reference: <testLibrary>::@class::B |
| firstFragment: <testLibraryFragment>::@class::B |
| constructors |
| synthetic new |
| firstFragment: <testLibraryFragment>::@class::B::@constructor::new |
| '''); |
| } |
| } |
| |
| @reflectiveTest |
| class ClassElementTest_augmentation_fromBytes |
| extends ClassElementTest_augmentation { |
| @override |
| bool get keepLinkingLibraries => false; |
| } |
| |
| @reflectiveTest |
| class ClassElementTest_augmentation_keepLinking |
| extends ClassElementTest_augmentation { |
| @override |
| bool get keepLinkingLibraries => true; |
| } |
| |
| @reflectiveTest |
| class ClassElementTest_fromBytes extends ClassElementTest { |
| @override |
| bool get keepLinkingLibraries => false; |
| } |
| |
| @reflectiveTest |
| class ClassElementTest_keepLinking extends ClassElementTest { |
| @override |
| bool get keepLinkingLibraries => true; |
| } |