| // 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:analyzer/dart/element/element.dart'; |
| import 'package:analyzer/src/dart/element/element.dart'; |
| 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(MetadataElementTest_keepLinking); |
| defineReflectiveTests(MetadataElementTest_fromBytes); |
| defineReflectiveTests(UpdateNodeTextExpectations); |
| }); |
| } |
| |
| abstract class MetadataElementTest extends ElementsBaseTest { |
| test_annotationArgument_recordLiteral() async { |
| var library = await buildLibrary(''' |
| @A((2, a: 3)) |
| class C {} |
| class A { |
| const A(o); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @20 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: A @1 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @2 |
| arguments |
| RecordLiteral |
| leftParenthesis: ( @3 |
| fields |
| IntegerLiteral |
| literal: 2 @4 |
| staticType: int |
| NamedExpression |
| name: Label |
| label: SimpleIdentifier |
| token: a @7 |
| staticElement: <null> |
| staticType: null |
| colon: : @8 |
| expression: IntegerLiteral |
| literal: 3 @10 |
| staticType: int |
| rightParenthesis: ) @11 |
| staticType: (int, {int a}) |
| rightParenthesis: ) @12 |
| element: <testLibraryFragment>::@class::A::@constructor::new |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| class A @31 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const @43 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional o @45 |
| type: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @20 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| class A @31 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const new @43 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| parameters |
| requiredPositional o |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_annotationArgument_recordLiteral_withConst() async { |
| var library = await buildLibrary(''' |
| @A(const ('',)) |
| class C {} |
| class A { |
| const A(o); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: A @1 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @2 |
| arguments |
| RecordLiteral |
| constKeyword: const @3 |
| leftParenthesis: ( @9 |
| fields |
| SimpleStringLiteral |
| literal: '' @10 |
| rightParenthesis: ) @13 |
| staticType: (String,) |
| rightParenthesis: ) @14 |
| element: <testLibraryFragment>::@class::A::@constructor::new |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| class A @33 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const @45 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional o @47 |
| type: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| class A @33 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const new @45 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| parameters |
| requiredPositional o |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| '''); |
| } |
| |
| test_invalid_annotation_prefixed_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class A { |
| const A.named(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "a.dart" as a; |
| @a.A.named |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/a.dart as a @19 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| a @19 |
| reference: <testLibraryFragment>::@prefix::a |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/a.dart as a @19 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| a @19 |
| reference: <testLibraryFragment>::@prefix::a |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @39 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @22 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: a @23 |
| staticElement: <testLibraryFragment>::@prefix::a |
| staticType: null |
| period: . @24 |
| identifier: SimpleIdentifier |
| token: A @25 |
| staticElement: package:test/a.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/a.dart::<fragment>::@class::A |
| staticType: null |
| period: . @26 |
| constructorName: SimpleIdentifier |
| token: named @27 |
| staticElement: package:test/a.dart::<fragment>::@class::A::@constructor::named |
| staticType: null |
| element: package:test/a.dart::<fragment>::@class::A::@constructor::named |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| prefixes |
| a |
| reference: <testLibraryFragment>::@prefix::a |
| classes |
| class C @39 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_invalid_annotation_unprefixed_constructor() async { |
| newFile('$testPackageLibPath/a.dart', r''' |
| class A { |
| const A.named(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "a.dart"; |
| @A.named |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/a.dart |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @32 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @17 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: A @18 |
| staticElement: package:test/a.dart::<fragment>::@class::A |
| staticType: null |
| period: . @19 |
| identifier: SimpleIdentifier |
| token: named @20 |
| staticElement: package:test/a.dart::<fragment>::@class::A::@constructor::named |
| staticType: null |
| staticElement: package:test/a.dart::<fragment>::@class::A::@constructor::named |
| staticType: null |
| element: package:test/a.dart::<fragment>::@class::A::@constructor::named |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/a.dart |
| classes |
| class C @32 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_class_field_first() async { |
| var library = await buildLibrary(r''' |
| const a = 0; |
| class C { |
| @a |
| int x = 0; |
| } |
| '''); |
| // Check metadata without asking any other properties. |
| var x = _elementOfDefiningUnit(library, ['@class', 'C', '@field', 'x']) |
| as FieldElement; |
| expect(x.metadata, hasLength(1)); |
| // Check details. |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @19 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| fields |
| x @34 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @25 |
| name: SimpleIdentifier |
| token: a @26 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| type: int |
| shouldUseTypeForInitializerInference: true |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| accessors |
| synthetic get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| returnType: int |
| synthetic set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x @-1 |
| type: int |
| returnType: void |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: int |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @10 |
| staticType: int |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @19 |
| reference: <testLibraryFragment>::@class::C |
| fields |
| x @34 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getter2: <testLibraryFragment>::@class::C::@getter::x |
| setter2: <testLibraryFragment>::@class::C::@setter::x |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getters |
| get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| setters |
| set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| parameters |
| _x @-1 |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| fields |
| x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: int |
| firstFragment: <testLibraryFragment>::@class::C::@field::x |
| getter: <none> |
| setter: <none> |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| getters |
| synthetic get x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C::@getter::x |
| setters |
| synthetic set x= |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x |
| reference: <none> |
| type: int |
| firstFragment: <testLibraryFragment>::@class::C::@setter::x |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: int |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_class_scope() async { |
| var library = await buildLibrary(r''' |
| const foo = 0; |
| |
| @foo |
| class C<@foo T> { |
| static const foo = 1; |
| @foo |
| void bar() {} |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @27 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: foo @17 |
| staticElement: <testLibraryFragment>::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@getter::foo |
| typeParameters |
| covariant T @34 |
| defaultType: dynamic |
| metadata |
| Annotation |
| atSign: @ @29 |
| name: SimpleIdentifier |
| token: foo @30 |
| staticElement: <testLibraryFragment>::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@getter::foo |
| fields |
| static const foo @54 |
| reference: <testLibraryFragment>::@class::C::@field::foo |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: int |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| IntegerLiteral |
| literal: 1 @60 |
| staticType: int |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| accessors |
| synthetic static get foo @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::foo |
| enclosingElement: <testLibraryFragment>::@class::C |
| returnType: int |
| methods |
| bar @77 |
| reference: <testLibraryFragment>::@class::C::@method::bar |
| enclosingElement: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @65 |
| name: SimpleIdentifier |
| token: foo @66 |
| staticElement: <testLibraryFragment>::@class::C::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@class::C::@getter::foo |
| returnType: void |
| topLevelVariables |
| static const foo @6 |
| reference: <testLibraryFragment>::@topLevelVariable::foo |
| enclosingElement: <testLibraryFragment> |
| type: int |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| IntegerLiteral |
| literal: 0 @12 |
| staticType: int |
| accessors |
| synthetic static get foo @-1 |
| reference: <testLibraryFragment>::@getter::foo |
| enclosingElement: <testLibraryFragment> |
| returnType: int |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @27 |
| reference: <testLibraryFragment>::@class::C |
| typeParameters |
| T @34 |
| metadata |
| Annotation |
| atSign: @ @29 |
| name: SimpleIdentifier |
| token: foo @30 |
| staticElement: <testLibraryFragment>::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@getter::foo |
| fields |
| foo @54 |
| reference: <testLibraryFragment>::@class::C::@field::foo |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getter2: <testLibraryFragment>::@class::C::@getter::foo |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getters |
| get foo @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::foo |
| enclosingFragment: <testLibraryFragment>::@class::C |
| methods |
| bar @77 |
| reference: <testLibraryFragment>::@class::C::@method::bar |
| enclosingFragment: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @65 |
| name: SimpleIdentifier |
| token: foo @66 |
| staticElement: <testLibraryFragment>::@class::C::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@class::C::@getter::foo |
| topLevelVariables |
| const foo @6 |
| reference: <testLibraryFragment>::@topLevelVariable::foo |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::foo |
| getters |
| get foo @-1 |
| reference: <testLibraryFragment>::@getter::foo |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| metadata |
| Annotation |
| atSign: @ @29 |
| name: SimpleIdentifier |
| token: foo @30 |
| staticElement: <testLibraryFragment>::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@getter::foo |
| firstFragment: <testLibraryFragment>::@class::C |
| fields |
| static const foo |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: int |
| firstFragment: <testLibraryFragment>::@class::C::@field::foo |
| getter: <none> |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| getters |
| synthetic static get foo |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C::@getter::foo |
| methods |
| bar |
| reference: <none> |
| metadata |
| Annotation |
| atSign: @ @65 |
| name: SimpleIdentifier |
| token: foo @66 |
| staticElement: <testLibraryFragment>::@class::C::@getter::foo |
| staticType: null |
| element: <testLibraryFragment>::@class::C::@getter::foo |
| firstFragment: <testLibraryFragment>::@class::C::@method::bar |
| topLevelVariables |
| const foo |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: int |
| firstFragment: <testLibraryFragment>::@topLevelVariable::foo |
| getter: <none> |
| getters |
| synthetic static get foo |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::foo |
| '''); |
| } |
| |
| test_metadata_classDeclaration() async { |
| var library = await buildLibrary(r''' |
| const a = null; |
| const b = null; |
| @a |
| @b |
| class C {}'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @44 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @32 |
| name: SimpleIdentifier |
| token: a @33 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| Annotation |
| atSign: @ @35 |
| name: SimpleIdentifier |
| token: b @36 |
| staticElement: <testLibraryFragment>::@getter::b |
| staticType: null |
| element: <testLibraryFragment>::@getter::b |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| static const b @22 |
| reference: <testLibraryFragment>::@topLevelVariable::b |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @26 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| synthetic static get b @-1 |
| reference: <testLibraryFragment>::@getter::b |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @44 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| const b @22 |
| reference: <testLibraryFragment>::@topLevelVariable::b |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::b |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| get b @-1 |
| reference: <testLibraryFragment>::@getter::b |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| const b |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::b |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| synthetic static get b |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::b |
| '''); |
| } |
| |
| test_metadata_classTypeAlias() async { |
| var library = await buildLibrary( |
| 'const a = null; @a class C = D with E; class D {} class E {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class alias C @25 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| supertype: D |
| mixins |
| E |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::D::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::D::@constructor::new |
| class D @45 |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::D |
| class E @56 |
| reference: <testLibraryFragment>::@class::E |
| enclosingElement: <testLibraryFragment> |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::E::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::E |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @25 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::D::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::D::@constructor::new |
| class D @45 |
| reference: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::D |
| class E @56 |
| reference: <testLibraryFragment>::@class::E |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::E::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::E |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class alias C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| supertype: D |
| constructors |
| synthetic new |
| reference: <none> |
| superConstructor: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| class D |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::D::@constructor::new |
| class E |
| reference: <testLibraryFragment>::@class::E |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::E |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::E::@constructor::new |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_constructor_call_named() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A.named(int _); |
| } |
| @A.named(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const named @20 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::A |
| periodOffset: 19 |
| nameEnd: 25 |
| parameters |
| requiredPositional _ @30 |
| type: int |
| class C @54 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @36 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: A @37 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| period: . @38 |
| identifier: SimpleIdentifier |
| token: named @39 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| staticType: null |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @44 |
| arguments |
| IntegerLiteral |
| literal: 0 @45 |
| staticType: int |
| rightParenthesis: ) @46 |
| element: <testLibraryFragment>::@class::A::@constructor::named |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const named @20 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::A |
| periodOffset: 19 |
| nameEnd: 25 |
| class C @54 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named |
| reference: <none> |
| parameters |
| requiredPositional _ |
| reference: <none> |
| type: int |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_generic_inference() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A.named(T _); |
| } |
| |
| @A.named(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @8 |
| defaultType: dynamic |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| parameters |
| requiredPositional _ @31 |
| type: T |
| class C @56 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @38 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: A @39 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| period: . @40 |
| identifier: SimpleIdentifier |
| token: named @41 |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @46 |
| arguments |
| IntegerLiteral |
| literal: 0 @47 |
| staticType: int |
| rightParenthesis: ) @48 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| typeParameters |
| T @8 |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| class C @56 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named |
| reference: <none> |
| parameters |
| requiredPositional _ |
| reference: <none> |
| type: T |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_generic_typeArguments() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A.named(); |
| } |
| |
| @A<int>.named() |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @8 |
| defaultType: dynamic |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| class C @57 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @35 |
| name: SimpleIdentifier |
| token: A @36 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| typeArguments: TypeArgumentList |
| leftBracket: < @37 |
| arguments |
| NamedType |
| name: int @38 |
| element: dart:core::<fragment>::@class::int |
| type: int |
| rightBracket: > @41 |
| period: . @42 |
| constructorName: SimpleIdentifier |
| token: named @43 |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @48 |
| rightParenthesis: ) @49 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| typeParameters |
| T @8 |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| class C @57 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_generic_typeArguments_disabledGenericMetadata() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A.named(); |
| } |
| |
| @A<int>.named() |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @8 |
| defaultType: dynamic |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| class C @57 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @35 |
| name: SimpleIdentifier |
| token: A @36 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| typeArguments: TypeArgumentList |
| leftBracket: < @37 |
| arguments |
| NamedType |
| name: int @38 |
| element: dart:core::<fragment>::@class::int |
| type: int |
| rightBracket: > @41 |
| period: . @42 |
| constructorName: SimpleIdentifier |
| token: named @43 |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @48 |
| rightParenthesis: ) @49 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| typeParameters |
| T @8 |
| constructors |
| const named @23 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::A |
| periodOffset: 22 |
| nameEnd: 28 |
| class C @57 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_prefixed() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| class A { |
| const A.named(int _); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import 'foo.dart' as foo; |
| @foo.A.named(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @48 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| period: . @32 |
| constructorName: SimpleIdentifier |
| token: named @33 |
| staticElement: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @38 |
| arguments |
| IntegerLiteral |
| literal: 0 @39 |
| staticType: int |
| rightParenthesis: ) @40 |
| element: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @48 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_prefixed_generic_inference() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| class A<T> { |
| const A.named(T _); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "foo.dart" as foo; |
| @foo.A.named(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @48 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| period: . @32 |
| constructorName: SimpleIdentifier |
| token: named @33 |
| staticElement: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @38 |
| arguments |
| IntegerLiteral |
| literal: 0 @39 |
| staticType: int |
| rightParenthesis: ) @40 |
| element: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @48 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_prefixed_generic_typeArguments() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| class A<T> { |
| const A.named(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "foo.dart" as foo; |
| @foo.A<int>.named() |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @52 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| typeArguments: TypeArgumentList |
| leftBracket: < @32 |
| arguments |
| NamedType |
| name: int @33 |
| element: dart:core::<fragment>::@class::int |
| type: int |
| rightBracket: > @36 |
| period: . @37 |
| constructorName: SimpleIdentifier |
| token: named @38 |
| staticElement: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @43 |
| rightParenthesis: ) @44 |
| element: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::named |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @52 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_named_synthetic_ofClassAlias_generic() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A.named(); |
| } |
| |
| mixin B {} |
| |
| class C<T> = A with B; |
| |
| @C.named() |
| class D {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const named @20 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::A |
| periodOffset: 19 |
| nameEnd: 25 |
| class alias C @50 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @52 |
| defaultType: dynamic |
| supertype: A |
| mixins |
| B |
| constructors |
| synthetic const named @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::named |
| class D @85 |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @68 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: C @69 |
| staticElement: <testLibraryFragment>::@class::C |
| staticType: null |
| period: . @70 |
| identifier: SimpleIdentifier |
| token: named @71 |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::C::@constructor::named |
| substitution: {T: dynamic} |
| staticType: null |
| staticElement: ConstructorMember |
| base: <testLibraryFragment>::@class::C::@constructor::named |
| substitution: {T: dynamic} |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @76 |
| rightParenthesis: ) @77 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::C::@constructor::named |
| substitution: {T: dynamic} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::D |
| mixins |
| mixin B @38 |
| reference: <testLibraryFragment>::@mixin::B |
| enclosingElement: <testLibraryFragment> |
| superclassConstraints |
| Object |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const named @20 |
| reference: <testLibraryFragment>::@class::A::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::A |
| periodOffset: 19 |
| nameEnd: 25 |
| class C @50 |
| reference: <testLibraryFragment>::@class::C |
| typeParameters |
| T @52 |
| constructors |
| synthetic const named @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| period: . @0 |
| constructorName: SimpleIdentifier |
| token: named @-1 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| staticType: null |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::named |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::named |
| class D @85 |
| reference: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::D |
| mixins |
| mixin B @38 |
| reference: <testLibraryFragment>::@mixin::B |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const named |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::named |
| class alias C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::C |
| supertype: A |
| constructors |
| synthetic const named |
| reference: <none> |
| superConstructor: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::named |
| class D |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::D::@constructor::new |
| mixins |
| mixin B |
| reference: <testLibraryFragment>::@mixin::B |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@mixin::B |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A(int _); |
| } |
| @A(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const @18 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @24 |
| type: int |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @30 |
| name: SimpleIdentifier |
| token: A @31 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @32 |
| arguments |
| IntegerLiteral |
| literal: 0 @33 |
| staticType: int |
| rightParenthesis: ) @34 |
| element: <testLibraryFragment>::@class::A::@constructor::new |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const new @18 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| parameters |
| requiredPositional _ |
| reference: <none> |
| type: int |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_generic_inference() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A(T _); |
| } |
| |
| @A(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @8 |
| defaultType: dynamic |
| constructors |
| const @21 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional _ @25 |
| type: T |
| class C @44 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @32 |
| name: SimpleIdentifier |
| token: A @33 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @34 |
| arguments |
| IntegerLiteral |
| literal: 0 @35 |
| staticType: int |
| rightParenthesis: ) @36 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::new |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| typeParameters |
| T @8 |
| constructors |
| const new @21 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| class C @44 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| parameters |
| requiredPositional _ |
| reference: <none> |
| type: T |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_generic_typeArguments() async { |
| var library = await buildLibrary(''' |
| class A<T> { |
| const A(); |
| } |
| |
| @A<int>() |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @8 |
| defaultType: dynamic |
| constructors |
| const @21 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| class C @45 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @29 |
| name: SimpleIdentifier |
| token: A @30 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| typeArguments: TypeArgumentList |
| leftBracket: < @31 |
| arguments |
| NamedType |
| name: int @32 |
| element: dart:core::<fragment>::@class::int |
| type: int |
| rightBracket: > @35 |
| arguments: ArgumentList |
| leftParenthesis: ( @36 |
| rightParenthesis: ) @37 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::A::@constructor::new |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| typeParameters |
| T @8 |
| constructors |
| const new @21 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| class C @45 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_prefixed() async { |
| newFile('$testPackageLibPath/foo.dart', 'class A { const A(_); }'); |
| var library = |
| await buildLibrary('import "foo.dart" as foo; @foo.A(0) class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @32 |
| arguments |
| IntegerLiteral |
| literal: 0 @33 |
| staticType: int |
| rightParenthesis: ) @34 |
| element: package:test/foo.dart::<fragment>::@class::A::@constructor::new |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_prefixed_generic_inference() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| class A<T> { |
| const A(T _); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "foo.dart" as foo; |
| @foo.A(0) |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @32 |
| arguments |
| IntegerLiteral |
| literal: 0 @33 |
| staticType: int |
| rightParenthesis: ) @34 |
| element: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::new |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @42 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_prefixed_generic_typeArguments() async { |
| newFile('$testPackageLibPath/foo.dart', ''' |
| class A<T> { |
| const A(); |
| } |
| '''); |
| var library = await buildLibrary(''' |
| import "foo.dart" as foo; |
| @foo.A<int>() |
| class C {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| prefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryImports |
| package:test/foo.dart as foo @21 |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| libraryImportPrefixes |
| foo @21 |
| reference: <testLibraryFragment>::@prefix::foo |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| classes |
| class C @46 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: PrefixedIdentifier |
| prefix: SimpleIdentifier |
| token: foo @27 |
| staticElement: <testLibraryFragment>::@prefix::foo |
| staticType: null |
| period: . @30 |
| identifier: SimpleIdentifier |
| token: A @31 |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| staticElement: package:test/foo.dart::<fragment>::@class::A |
| staticType: null |
| typeArguments: TypeArgumentList |
| leftBracket: < @32 |
| arguments |
| NamedType |
| name: int @33 |
| element: dart:core::<fragment>::@class::int |
| type: int |
| rightBracket: > @36 |
| arguments: ArgumentList |
| leftParenthesis: ( @37 |
| rightParenthesis: ) @38 |
| element: ConstructorMember |
| base: package:test/foo.dart::<fragment>::@class::A::@constructor::new |
| substitution: {T: int} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| libraryImports |
| package:test/foo.dart |
| prefixes |
| foo |
| reference: <testLibraryFragment>::@prefix::foo |
| classes |
| class C @46 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructor_call_unnamed_synthetic_ofClassAlias_generic() async { |
| var library = await buildLibrary(''' |
| class A { |
| const A(); |
| } |
| |
| mixin B {} |
| |
| class C<T> = A with B; |
| |
| @C() |
| class D {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const @18 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| class alias C @44 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| typeParameters |
| covariant T @46 |
| defaultType: dynamic |
| supertype: A |
| mixins |
| B |
| constructors |
| synthetic const @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new |
| class D @73 |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @62 |
| name: SimpleIdentifier |
| token: C @63 |
| staticElement: <testLibraryFragment>::@class::C |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @64 |
| rightParenthesis: ) @65 |
| element: ConstructorMember |
| base: <testLibraryFragment>::@class::C::@constructor::new |
| substitution: {T: dynamic} |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::D |
| mixins |
| mixin B @32 |
| reference: <testLibraryFragment>::@mixin::B |
| enclosingElement: <testLibraryFragment> |
| superclassConstraints |
| Object |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const new @18 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| class C @44 |
| reference: <testLibraryFragment>::@class::C |
| typeParameters |
| T @46 |
| constructors |
| synthetic const new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| constantInitializers |
| SuperConstructorInvocation |
| superKeyword: super @0 |
| argumentList: ArgumentList |
| leftParenthesis: ( @0 |
| rightParenthesis: ) @0 |
| staticElement: <testLibraryFragment>::@class::A::@constructor::new |
| superConstructor: <testLibraryFragment>::@class::A::@constructor::new |
| class D @73 |
| reference: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::D::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::D |
| mixins |
| mixin B @32 |
| reference: <testLibraryFragment>::@mixin::B |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class alias C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| typeParameters |
| T |
| firstFragment: <testLibraryFragment>::@class::C |
| supertype: A |
| constructors |
| synthetic const new |
| reference: <none> |
| superConstructor: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| class D |
| reference: <testLibraryFragment>::@class::D |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::D |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::D::@constructor::new |
| mixins |
| mixin B |
| reference: <testLibraryFragment>::@mixin::B |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@mixin::B |
| superclassConstraints |
| Object |
| '''); |
| } |
| |
| test_metadata_constructor_call_with_args() async { |
| var library = |
| await buildLibrary('class A { const A(x); } @A(null) class C {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement: <testLibraryFragment> |
| constructors |
| const @16 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::A |
| parameters |
| requiredPositional x @18 |
| type: dynamic |
| class C @39 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @24 |
| name: SimpleIdentifier |
| token: A @25 |
| staticElement: <testLibraryFragment>::@class::A |
| staticType: null |
| arguments: ArgumentList |
| leftParenthesis: ( @26 |
| arguments |
| NullLiteral |
| literal: null @27 |
| staticType: Null |
| rightParenthesis: ) @31 |
| element: <testLibraryFragment>::@class::A::@constructor::new |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class A @6 |
| reference: <testLibraryFragment>::@class::A |
| constructors |
| const new @16 |
| reference: <testLibraryFragment>::@class::A::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::A |
| class C @39 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| classes |
| class A |
| reference: <testLibraryFragment>::@class::A |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::A |
| constructors |
| const new |
| reference: <none> |
| parameters |
| requiredPositional x |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::A::@constructor::new |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| '''); |
| } |
| |
| test_metadata_constructorDeclaration_named() async { |
| var library = |
| await buildLibrary('const a = null; class C { @a C.named(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| constructors |
| named @31 |
| reference: <testLibraryFragment>::@class::C::@constructor::named |
| enclosingElement: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| periodOffset: 30 |
| nameEnd: 36 |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| named @31 |
| reference: <testLibraryFragment>::@class::C::@constructor::named |
| enclosingFragment: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| periodOffset: 30 |
| nameEnd: 36 |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| named |
| reference: <none> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::named |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_constructorDeclaration_unnamed() async { |
| var library = await buildLibrary('const a = null; class C { @a C(); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| constructors |
| @29 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| constructors |
| new @29 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| constructors |
| new |
| reference: <none> |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_exportDirective() async { |
| newFile('$testPackageLibPath/foo.dart', ''); |
| var library = await buildLibrary('@a export "foo.dart"; const a = null;'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: a @1 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| libraryExports |
| package:test/foo.dart |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: a @1 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| libraryExports |
| package:test/foo.dart |
| enclosingElement: <testLibrary> |
| enclosingElement3: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: a @1 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| topLevelVariables |
| static const a @28 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @32 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| metadata |
| Annotation |
| atSign: @ @0 |
| name: SimpleIdentifier |
| token: a @1 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @28 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_fieldDeclaration() async { |
| var library = await buildLibrary('const a = null; class C { @a int x; }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| fields |
| x @33 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| metadata |
| Annotation |
| atSign: @ @26 |
| name: SimpleIdentifier |
| token: a @27 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| type: int |
| constructors |
| synthetic @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| accessors |
| synthetic get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| returnType: int |
| synthetic set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x @-1 |
| type: int |
| returnType: void |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| fields |
| x @33 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getter2: <testLibraryFragment>::@class::C::@getter::x |
| setter2: <testLibraryFragment>::@class::C::@setter::x |
| constructors |
| synthetic new @-1 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getters |
| get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| setters |
| set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| parameters |
| _x @-1 |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| fields |
| x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: int |
| firstFragment: <testLibraryFragment>::@class::C::@field::x |
| getter: <none> |
| setter: <none> |
| constructors |
| synthetic new |
| reference: <none> |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| getters |
| synthetic get x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C::@getter::x |
| setters |
| synthetic set x= |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x |
| reference: <none> |
| type: int |
| firstFragment: <testLibraryFragment>::@class::C::@setter::x |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_fieldFormalParameter() async { |
| var library = await buildLibrary(''' |
| const a = null; |
| class C { |
| var x; |
| C(@a this.x); |
| } |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| fields |
| x @32 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: dynamic |
| constructors |
| @37 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional final this.x @47 |
| type: dynamic |
| metadata |
| Annotation |
| atSign: @ @39 |
| name: SimpleIdentifier |
| token: a @40 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| field: <testLibraryFragment>::@class::C::@field::x |
| accessors |
| synthetic get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| returnType: dynamic |
| synthetic set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x @-1 |
| type: dynamic |
| returnType: void |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| fields |
| x @32 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getter2: <testLibraryFragment>::@class::C::@getter::x |
| setter2: <testLibraryFragment>::@class::C::@setter::x |
| constructors |
| new @37 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getters |
| get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| setters |
| set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| parameters |
| _x @-1 |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| fields |
| x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::C::@field::x |
| getter: <none> |
| setter: <none> |
| constructors |
| new |
| reference: <none> |
| parameters |
| requiredPositional final x |
| reference: <none> |
| type: dynamic |
| metadata |
| Annotation |
| atSign: @ @39 |
| name: SimpleIdentifier |
| token: a @40 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| getters |
| synthetic get x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C::@getter::x |
| setters |
| synthetic set x= |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::C::@setter::x |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_fieldFormalParameter_withDefault() async { |
| var library = await buildLibrary( |
| 'const a = null; class C { var x; C([@a this.x = null]); }'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement: <testLibraryFragment> |
| fields |
| x @30 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: dynamic |
| constructors |
| @33 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| optionalPositional default final this.x @44 |
| type: dynamic |
| metadata |
| Annotation |
| atSign: @ @36 |
| name: SimpleIdentifier |
| token: a @37 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| constantInitializer |
| NullLiteral |
| literal: null @48 |
| staticType: Null |
| field: <testLibraryFragment>::@class::C::@field::x |
| accessors |
| synthetic get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| returnType: dynamic |
| synthetic set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x @-1 |
| type: dynamic |
| returnType: void |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| classes |
| class C @22 |
| reference: <testLibraryFragment>::@class::C |
| fields |
| x @30 |
| reference: <testLibraryFragment>::@class::C::@field::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getter2: <testLibraryFragment>::@class::C::@getter::x |
| setter2: <testLibraryFragment>::@class::C::@setter::x |
| constructors |
| new @33 |
| reference: <testLibraryFragment>::@class::C::@constructor::new |
| enclosingFragment: <testLibraryFragment>::@class::C |
| getters |
| get x @-1 |
| reference: <testLibraryFragment>::@class::C::@getter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| setters |
| set x= @-1 |
| reference: <testLibraryFragment>::@class::C::@setter::x |
| enclosingFragment: <testLibraryFragment>::@class::C |
| parameters |
| _x @-1 |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| classes |
| class C |
| reference: <testLibraryFragment>::@class::C |
| enclosingElement2: <testLibrary> |
| firstFragment: <testLibraryFragment>::@class::C |
| fields |
| x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::C::@field::x |
| getter: <none> |
| setter: <none> |
| constructors |
| new |
| reference: <none> |
| parameters |
| optionalPositional final x |
| reference: <none> |
| type: dynamic |
| metadata |
| Annotation |
| atSign: @ @36 |
| name: SimpleIdentifier |
| token: a @37 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| firstFragment: <testLibraryFragment>::@class::C::@constructor::new |
| getters |
| synthetic get x |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| firstFragment: <testLibraryFragment>::@class::C::@getter::x |
| setters |
| synthetic set x= |
| reference: <none> |
| enclosingElement: <testLibraryFragment>::@class::C |
| parameters |
| requiredPositional _x |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@class::C::@setter::x |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_functionDeclaration_function() async { |
| var library = await buildLibrary(''' |
| const a = null; |
| @a |
| f() {} |
| '''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| functions |
| f @19 |
| reference: <testLibraryFragment>::@function::f |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_functionDeclaration_getter() async { |
| var library = await buildLibrary('const a = null; @a get f => null;'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| synthetic static f @-1 |
| reference: <testLibraryFragment>::@topLevelVariable::f |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| static get f @23 |
| reference: <testLibraryFragment>::@getter::f |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| synthetic f @-1 |
| reference: <testLibraryFragment>::@topLevelVariable::f |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::f |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| get f @23 |
| reference: <testLibraryFragment>::@getter::f |
| enclosingFragment: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| synthetic f |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::f |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| static get f |
| reference: <none> |
| enclosingElement: <testLibrary> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| firstFragment: <testLibraryFragment>::@getter::f |
| '''); |
| } |
| |
| test_metadata_functionDeclaration_setter() async { |
| var library = await buildLibrary('const a = null; @a set f(value) {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| synthetic static f @-1 |
| reference: <testLibraryFragment>::@topLevelVariable::f |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| static set f= @23 |
| reference: <testLibraryFragment>::@setter::f |
| enclosingElement: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| parameters |
| requiredPositional value @25 |
| type: dynamic |
| returnType: void |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| synthetic f @-1 |
| reference: <testLibraryFragment>::@topLevelVariable::f |
| enclosingFragment: <testLibraryFragment> |
| setter2: <testLibraryFragment>::@setter::f |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| setters |
| set f= @23 |
| reference: <testLibraryFragment>::@setter::f |
| enclosingFragment: <testLibraryFragment> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| parameters |
| value @25 |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| synthetic f |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::f |
| setter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| setters |
| static set f= |
| reference: <none> |
| enclosingElement: <testLibrary> |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| parameters |
| requiredPositional value |
| reference: <none> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@setter::f |
| '''); |
| } |
| |
| test_metadata_functionTypeAlias() async { |
| var library = await buildLibrary('const a = null; @a typedef F();'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| typeAliases |
| functionTypeAliasBased F @27 |
| reference: <testLibraryFragment>::@typeAlias::F |
| metadata |
| Annotation |
| atSign: @ @16 |
| name: SimpleIdentifier |
| token: a @17 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| aliasedType: dynamic Function() |
| aliasedElement: GenericFunctionTypeElement |
| returnType: dynamic |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_functionTypedFormalParameter() async { |
| var library = await buildLibrary('const a = null; f(@a g()) {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| functions |
| f @16 |
| reference: <testLibraryFragment>::@function::f |
| enclosingElement: <testLibraryFragment> |
| parameters |
| requiredPositional g @21 |
| type: dynamic Function() |
| metadata |
| Annotation |
| atSign: @ @18 |
| name: SimpleIdentifier |
| token: a @19 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_functionTypedFormalParameter_withDefault() async { |
| var library = await buildLibrary('const a = null; f([@a g() = null]) {}'); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| functions |
| f @16 |
| reference: <testLibraryFragment>::@function::f |
| enclosingElement: <testLibraryFragment> |
| parameters |
| optionalPositional default g @22 |
| type: dynamic Function() |
| metadata |
| Annotation |
| atSign: @ @19 |
| name: SimpleIdentifier |
| token: a @20 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| constantInitializer |
| NullLiteral |
| literal: null @28 |
| staticType: null |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| getters |
| synthetic static get a |
| reference: <none> |
| enclosingElement: <testLibrary> |
| firstFragment: <testLibraryFragment>::@getter::a |
| '''); |
| } |
| |
| test_metadata_genericTypeAlias() async { |
| var library = await buildLibrary(r''' |
| const a = null; |
| const b = null; |
| @a |
| @b |
| typedef F = void Function();'''); |
| checkElementText(library, r''' |
| library |
| reference: <testLibrary> |
| definingUnit: <testLibraryFragment> |
| units |
| <testLibraryFragment> |
| enclosingElement: <testLibrary> |
| typeAliases |
| F @46 |
| reference: <testLibraryFragment>::@typeAlias::F |
| metadata |
| Annotation |
| atSign: @ @32 |
| name: SimpleIdentifier |
| token: a @33 |
| staticElement: <testLibraryFragment>::@getter::a |
| staticType: null |
| element: <testLibraryFragment>::@getter::a |
| Annotation |
| atSign: @ @35 |
| name: SimpleIdentifier |
| token: b @36 |
| staticElement: <testLibraryFragment>::@getter::b |
| staticType: null |
| element: <testLibraryFragment>::@getter::b |
| aliasedType: void Function() |
| aliasedElement: GenericFunctionTypeElement |
| returnType: void |
| topLevelVariables |
| static const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @10 |
| staticType: Null |
| static const b @22 |
| reference: <testLibraryFragment>::@topLevelVariable::b |
| enclosingElement: <testLibraryFragment> |
| type: dynamic |
| shouldUseTypeForInitializerInference: false |
| constantInitializer |
| NullLiteral |
| literal: null @26 |
| staticType: Null |
| accessors |
| synthetic static get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| synthetic static get b @-1 |
| reference: <testLibraryFragment>::@getter::b |
| enclosingElement: <testLibraryFragment> |
| returnType: dynamic |
| ---------------------------------------- |
| library |
| reference: <testLibrary> |
| fragments |
| <testLibraryFragment> |
| topLevelVariables |
| const a @6 |
| reference: <testLibraryFragment>::@topLevelVariable::a |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::a |
| const b @22 |
| reference: <testLibraryFragment>::@topLevelVariable::b |
| enclosingFragment: <testLibraryFragment> |
| getter2: <testLibraryFragment>::@getter::b |
| getters |
| get a @-1 |
| reference: <testLibraryFragment>::@getter::a |
| enclosingFragment: <testLibraryFragment> |
| get b @-1 |
| reference: <testLibraryFragment>::@getter::b |
| enclosingFragment: <testLibraryFragment> |
| topLevelVariables |
| const a |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| firstFragment: <testLibraryFragment>::@topLevelVariable::a |
| getter: <none> |
| const b |
| reference: <none> |
| enclosingElement2: <testLibrary> |
| type: dynamic |
| |