| // 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/ast/ast.dart'; | |
| import 'package:analyzer/dart/element/type.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(ConstElementTest_keepLinking); | |
| defineReflectiveTests(ConstElementTest_fromBytes); | |
| defineReflectiveTests(UpdateNodeTextExpectations); | |
| }); | |
| } | |
| abstract class ConstElementTest extends ElementsBaseTest { | |
| test_const_asExpression() async { | |
| var library = await buildLibrary(r''' | |
| const num a = 0; | |
| const b = a as int; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:10) (firstTokenOffset:10) (offset:10) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @14 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:23) (firstTokenOffset:23) (offset:23) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| AsExpression | |
| expression2: UnqualifiedNameExpression | |
| name: a @27 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: num Function() | |
| type: num | |
| staticType: num | |
| expression(v1): SimpleIdentifier | |
| token: a @27 | |
| element: <testLibrary>::@getter::a | |
| staticType: num | |
| asOperator: as @29 | |
| type: NamedType | |
| name: int @32 | |
| element: dart:core::@class::int | |
| type: int | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:10) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: num | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: num | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_assignmentExpression() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = (a += 1); | |
| const c = (a = 1); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @23 | |
| expression2: CompoundAssignment | |
| target: UnqualifiedNameAssignmentTarget | |
| name: a @24 | |
| read: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| write: InvalidNamedWriteResolution | |
| recoveryElement: <testLibrary>::@getter::a | |
| operator: += @26 | |
| value: IntegerLiteral | |
| literal: 1 @29 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| operatorResultType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: SimpleIdentifier | |
| token: a @24 | |
| element: <null> | |
| staticType: null | |
| operator: += @26 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @29 | |
| staticType: int | |
| readElement: <testLibrary>::@getter::a | |
| readType: int | |
| writeElement: <testLibrary>::@getter::a | |
| writeType: InvalidType | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| rightParenthesis: ) @30 | |
| staticType: int | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic c (nameOffset:39) (firstTokenOffset:39) (offset:39) | |
| element: <testLibrary>::@topLevelVariable::c | |
| initializer: expression_2 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @43 | |
| expression2: DirectAssignment | |
| target: UnqualifiedNameAssignmentTarget | |
| name: a @44 | |
| read: <null> | |
| write: InvalidNamedWriteResolution | |
| recoveryElement: <testLibrary>::@getter::a | |
| operator: = @46 | |
| value: IntegerLiteral | |
| literal: 1 @48 | |
| staticType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: SimpleIdentifier | |
| token: a @44 | |
| element: <null> | |
| staticType: null | |
| operator: = @46 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @48 | |
| staticType: int | |
| readElement: <null> | |
| readType: null | |
| writeElement: <testLibrary>::@getter::a | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: int | |
| rightParenthesis: ) @49 | |
| staticType: int | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39) | |
| element: <testLibrary>::@getter::c | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@topLevelVariable::c | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::c | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@getter::c | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::c | |
| '''); | |
| } | |
| test_const_assignmentExpression_importPrefixed() async { | |
| newFile('$testPackageLibPath/a.dart', 'int x = 0;'); | |
| var library = await buildLibrary(''' | |
| import 'a.dart' as p; | |
| const a = (p.x += 1); | |
| const b = (p.x = 2); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:28) (firstTokenOffset:28) (offset:28) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @32 | |
| expression2: CompoundAssignment | |
| target: ImportPrefixedAssignmentTarget | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: x @35 | |
| read: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::x | |
| invokeType: int Function() | |
| type: int | |
| write: SetterInvocationResolution | |
| element: package:test/a.dart::@setter::x | |
| acceptedType: int | |
| operator: += @37 | |
| value: IntegerLiteral | |
| literal: 1 @40 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| operatorResultType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: PrefixedIdentifier | |
| prefix: SimpleIdentifier | |
| token: p @33 | |
| element: <testLibraryFragment>::@prefix::p | |
| staticType: null | |
| period: . @34 | |
| identifier: SimpleIdentifier | |
| token: x @35 | |
| element: <null> | |
| staticType: null | |
| element: <null> | |
| staticType: null | |
| operator: += @37 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @40 | |
| staticType: int | |
| readElement: package:test/a.dart::@getter::x | |
| readType: int | |
| writeElement: package:test/a.dart::@setter::x | |
| writeType: int | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| rightParenthesis: ) @41 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:50) (firstTokenOffset:50) (offset:50) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @54 | |
| expression2: DirectAssignment | |
| target: ImportPrefixedAssignmentTarget | |
| importPrefix: ImportPrefixReference | |
| name: p @55 | |
| period: . @56 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: x @57 | |
| read: <null> | |
| write: SetterInvocationResolution | |
| element: package:test/a.dart::@setter::x | |
| acceptedType: int | |
| operator: = @59 | |
| value: IntegerLiteral | |
| literal: 2 @61 | |
| staticType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: PrefixedIdentifier | |
| prefix: SimpleIdentifier | |
| token: p @55 | |
| element: <testLibraryFragment>::@prefix::p | |
| staticType: null | |
| period: . @56 | |
| identifier: SimpleIdentifier | |
| token: x @57 | |
| element: <null> | |
| staticType: null | |
| element: <null> | |
| staticType: null | |
| operator: = @59 | |
| rightHandSide: IntegerLiteral | |
| literal: 2 @61 | |
| staticType: int | |
| readElement: <null> | |
| readType: null | |
| writeElement: package:test/a.dart::@setter::x | |
| writeType: int | |
| element: <null> | |
| staticType: int | |
| rightParenthesis: ) @62 | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:50) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_assignmentExpression_invalidTarget_direct() async { | |
| var library = await buildLibrary(r''' | |
| const a = (0 = 1); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @10 | |
| expression2: DirectAssignment | |
| target: InvalidExpressionAssignmentTarget | |
| expression: IntegerLiteral | |
| literal: 0 @11 | |
| staticType: int | |
| write: InvalidWriteResolution | |
| operator: = @13 | |
| value: IntegerLiteral | |
| literal: 1 @15 | |
| staticType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: IntegerLiteral | |
| literal: 0 @11 | |
| staticType: int | |
| operator: = @13 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @15 | |
| staticType: int | |
| readElement: <null> | |
| readType: null | |
| writeElement: <null> | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: int | |
| rightParenthesis: ) @16 | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_assignmentExpression_invalidTarget_ifNull() async { | |
| var library = await buildLibrary(r''' | |
| const a = (0 ??= 1); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @10 | |
| expression2: IfNullAssignment | |
| target: InvalidExpressionAssignmentTarget | |
| expression: IntegerLiteral | |
| literal: 0 @11 | |
| staticType: int | |
| read: InvalidReadResolution | |
| write: InvalidWriteResolution | |
| operator: ??= @13 | |
| value: IntegerLiteral | |
| literal: 1 @17 | |
| staticType: int | |
| staticType: int | |
| expression(v1): AssignmentExpression | |
| leftHandSide: IntegerLiteral | |
| literal: 0 @11 | |
| staticType: int | |
| operator: ??= @13 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @17 | |
| staticType: int | |
| readElement: <null> | |
| readType: int | |
| writeElement: <null> | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: int | |
| rightParenthesis: ) @18 | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_cascadeExpression() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0 | |
| ..isEven | |
| ..abs(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| CascadeExpression | |
| target2: IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| sections | |
| CascadeSection | |
| operator: .. @14 | |
| body: CascadePropertyExtraction | |
| name: isEven @16 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::int::@getter::isEven | |
| invokeType: bool Function() | |
| type: bool | |
| staticType: bool | |
| CascadeSection | |
| operator: .. @25 | |
| body: CascadeMethodInvocation | |
| name: abs @27 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @30 | |
| rightParenthesis: ) @31 | |
| resolution: ExecutableInvocationResolution | |
| element: dart:core::@class::int::@method::abs | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| cascadeSections | |
| PropertyAccess | |
| operator: .. @14 | |
| propertyName: SimpleIdentifier | |
| token: isEven @16 | |
| element: dart:core::@class::int::@getter::isEven | |
| staticType: bool | |
| staticType: bool | |
| MethodInvocation | |
| operator: .. @25 | |
| methodName: SimpleIdentifier | |
| token: abs @27 | |
| element: dart:core::@class::int::@method::abs | |
| staticType: int Function() | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @30 | |
| rightParenthesis: ) @31 | |
| staticInvokeType: int Function() | |
| staticType: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_cascadeExpression_indexSections() async { | |
| var library = await buildLibrary(r''' | |
| const a = <int>[0] | |
| ..[0] | |
| ..[0] = 1; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| CascadeExpression | |
| target2: ListLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @10 | |
| arguments | |
| NamedType | |
| name: int @11 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @14 | |
| leftBracket: [ @15 | |
| elements2 | |
| IntegerLiteral | |
| literal: 0 @16 | |
| staticType: int | |
| rightBracket: ] @17 | |
| staticType: List<int> | |
| sections | |
| CascadeSection | |
| operator: .. @21 | |
| body: CascadeIndexExpression | |
| leftBracket: [ @23 | |
| index: IntegerLiteral | |
| literal: 0 @24 | |
| staticType: int | |
| rightBracket: ] @25 | |
| resolution: MethodIndexReadResolution | |
| element: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[] | |
| substitution: {E: int} | |
| invokeType: int Function(int) | |
| type: int | |
| staticType: int | |
| CascadeSection | |
| operator: .. @29 | |
| body: DirectAssignment | |
| target: CascadeIndexAssignmentTarget | |
| leftBracket: [ @31 | |
| index: IntegerLiteral | |
| literal: 0 @32 | |
| staticType: int | |
| rightBracket: ] @33 | |
| read: <null> | |
| write: MethodIndexWriteResolution | |
| element: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[]= | |
| substitution: {E: int} | |
| invokeType: void Function(int, int) | |
| acceptedType: int | |
| operator: = @35 | |
| value: IntegerLiteral | |
| literal: 1 @37 | |
| staticType: int | |
| staticType: int | |
| cascadeSections | |
| IndexExpression | |
| period: .. @21 | |
| leftBracket: [ @23 | |
| index: IntegerLiteral | |
| literal: 0 @24 | |
| staticType: int | |
| rightBracket: ] @25 | |
| element: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[] | |
| substitution: {E: int} | |
| staticType: int | |
| AssignmentExpression | |
| leftHandSide: IndexExpression | |
| period: .. @29 | |
| leftBracket: [ @31 | |
| index: IntegerLiteral | |
| literal: 0 @32 | |
| staticType: int | |
| rightBracket: ] @33 | |
| element: <null> | |
| staticType: null | |
| operator: = @35 | |
| rightHandSide: IntegerLiteral | |
| literal: 1 @37 | |
| staticType: int | |
| readElement: <null> | |
| readType: null | |
| writeElement: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[]= | |
| substitution: {E: int} | |
| writeType: int | |
| element: <null> | |
| staticType: int | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: List<int> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: List<int> | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_classField() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const int f1 = 1; | |
| static const int f2 = C.f1, f3 = C.f2; | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasInitializer isConst isOriginDeclaration isStatic f1 (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@class::C::@field::f1 | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 1 @34 | |
| staticType: int | |
| inducedGetter: #F3 | |
| #F4 hasInitializer isConst isOriginDeclaration isStatic f2 (nameOffset:56) (firstTokenOffset:56) (offset:56) | |
| element: <testLibrary>::@class::C::@field::f2 | |
| initializer: expression_1 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @61 | |
| element: <testLibrary>::@class::C | |
| operator: . @62 | |
| name: f1 @63 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::C::@getter::f1 | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F5 | |
| #F6 hasInitializer isConst isOriginDeclaration isStatic f3 (nameOffset:67) (firstTokenOffset:67) (offset:67) | |
| element: <testLibrary>::@class::C::@field::f3 | |
| initializer: expression_2 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @72 | |
| element: <testLibrary>::@class::C | |
| operator: . @73 | |
| name: f2 @74 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::C::@getter::f2 | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F7 | |
| constructors | |
| #F8 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic f1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@class::C::@getter::f1 | |
| inducingVariable: #F2 | |
| #F5 isComplete isOriginVariable isStatic f2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:56) | |
| element: <testLibrary>::@class::C::@getter::f2 | |
| inducingVariable: #F4 | |
| #F7 isComplete isOriginVariable isStatic f3 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:67) | |
| element: <testLibrary>::@class::C::@getter::f3 | |
| inducingVariable: #F6 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasInitializer isConst isOriginDeclaration isStatic f1 | |
| reference: <testLibrary>::@class::C::@field::f1 | |
| firstFragment: #F2 | |
| type: int | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::f1 | |
| hasInitializer isConst isOriginDeclaration isStatic f2 | |
| reference: <testLibrary>::@class::C::@field::f2 | |
| firstFragment: #F4 | |
| type: int | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_1 | |
| getter: <testLibrary>::@class::C::@getter::f2 | |
| hasInitializer isConst isOriginDeclaration isStatic f3 | |
| reference: <testLibrary>::@class::C::@field::f3 | |
| firstFragment: #F6 | |
| type: int | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_2 | |
| getter: <testLibrary>::@class::C::@getter::f3 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F8 | |
| getters | |
| isOriginVariable isStatic f1 | |
| reference: <testLibrary>::@class::C::@getter::f1 | |
| firstFragment: #F3 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f1 | |
| isOriginVariable isStatic f2 | |
| reference: <testLibrary>::@class::C::@getter::f2 | |
| firstFragment: #F5 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f2 | |
| isOriginVariable isStatic f3 | |
| reference: <testLibrary>::@class::C::@getter::f3 | |
| firstFragment: #F7 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f3 | |
| '''); | |
| } | |
| test_const_constructor_inferred_args() async { | |
| var library = await buildLibrary(r''' | |
| class C<T> { | |
| final T t; | |
| const C(this.t); | |
| const C.named(this.t); | |
| } | |
| const Object x = const C(0); | |
| const Object y = const C.named(0); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| fields | |
| #F3 isFinal isOriginDeclaration t (nameOffset:23) (firstTokenOffset:23) (offset:23) | |
| element: <testLibrary>::@class::C::@field::t | |
| inducedGetter: #F4 | |
| constructors | |
| #F5 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:34) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 34 | |
| formalParameters | |
| #F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.t (nameOffset:41) (firstTokenOffset:36) (offset:41) | |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::t | |
| #F7 isComplete isConst isOriginDeclaration named (nameOffset:55) (firstTokenOffset:47) (offset:55) | |
| element: <testLibrary>::@class::C::@constructor::named | |
| typeName: C | |
| typeNameOffset: 53 | |
| periodOffset: 54 | |
| formalParameters | |
| #F8 requiredPositional hasImplicitType isFinal isOriginDeclaration this.t (nameOffset:66) (firstTokenOffset:61) (offset:66) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::t | |
| getters | |
| #F4 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23) | |
| element: <testLibrary>::@class::C::@getter::t | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| #F9 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:86) (firstTokenOffset:86) (offset:86) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @90 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @96 | |
| element: <testLibrary>::@class::C | |
| type: C<int> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {T: int} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @97 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @98 | |
| staticType: int | |
| rightParenthesis: ) @99 | |
| staticType: C<int> | |
| inducedGetter: #F10 | |
| #F11 hasInitializer isConst isOriginDeclaration isStatic y (nameOffset:115) (firstTokenOffset:115) (offset:115) | |
| element: <testLibrary>::@topLevelVariable::y | |
| initializer: expression_1 | |
| ConstructorInvocation | |
| keyword: const @119 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @125 | |
| element: <testLibrary>::@class::C | |
| type: C<int> | |
| selector: ConstructorSelector | |
| period: . @126 | |
| name2: named @127 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::named | |
| substitution: {T: int} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @132 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @133 | |
| staticType: int | |
| rightParenthesis: ) @134 | |
| staticType: C<int> | |
| inducedGetter: #F12 | |
| getters | |
| #F10 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:86) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F9 | |
| #F12 isComplete isOriginVariable isStatic y (nameOffset:<null>) (firstTokenOffset:<null>) (offset:115) | |
| element: <testLibrary>::@getter::y | |
| inducingVariable: #F11 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| fields | |
| hasEnclosingTypeParameterReference isFinal isOriginDeclaration t | |
| reference: <testLibrary>::@class::C::@field::t | |
| firstFragment: #F3 | |
| type: T | |
| getter: <testLibrary>::@class::C::@getter::t | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F5 | |
| formalParameters | |
| #E1 requiredPositional hasImplicitType isFinal this.t | |
| firstFragment: #F6 | |
| type: T | |
| field: <testLibrary>::@class::C::@field::t | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration named | |
| reference: <testLibrary>::@class::C::@constructor::named | |
| firstFragment: #F7 | |
| formalParameters | |
| #E2 requiredPositional hasImplicitType isFinal this.t | |
| firstFragment: #F8 | |
| type: T | |
| field: <testLibrary>::@class::C::@field::t | |
| getters | |
| hasEnclosingTypeParameterReference isOriginVariable t | |
| reference: <testLibrary>::@class::C::@getter::t | |
| firstFragment: #F4 | |
| returnType: T | |
| variable: <testLibrary>::@class::C::@field::t | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F9 | |
| type: Object | |
| constantInitializer | |
| fragment: #F9 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| hasInitializer isConst isOriginDeclaration isStatic y | |
| reference: <testLibrary>::@topLevelVariable::y | |
| firstFragment: #F11 | |
| type: Object | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::y | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F10 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| isOriginVariable isStatic y | |
| reference: <testLibrary>::@getter::y | |
| firstFragment: #F12 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::y | |
| '''); | |
| var x = library.firstFragment.topLevelVariables[0]; | |
| var xExpr = x.constantInitializer2 as ConstructorInvocation; | |
| var xType = xExpr.constructorReference.element!.returnType; | |
| _assertTypeStr(xType, 'C<int>'); | |
| var y = library.firstFragment.topLevelVariables[0]; | |
| var yExpr = y.constantInitializer2 as ConstructorInvocation; | |
| var yType = yExpr.constructorReference.element!.returnType; | |
| _assertTypeStr(yType, 'C<int>'); | |
| } | |
| test_const_constructorTearOff() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| A.named(); | |
| } | |
| const v = A.named; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isOriginDeclaration named (nameOffset:14) (firstTokenOffset:12) (offset:14) | |
| element: <testLibrary>::@class::A::@constructor::named | |
| typeName: A | |
| typeNameOffset: 12 | |
| periodOffset: 13 | |
| topLevelVariables | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ConstructorTearOff | |
| typeReference: ConstructorTypeReference | |
| name: A @36 | |
| element: <testLibrary>::@class::A | |
| type: A | |
| selector: ConstructorSelector | |
| period: . @37 | |
| name2: named @38 | |
| element: <testLibrary>::@class::A::@constructor::named | |
| staticType: A Function() | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isOriginDeclaration named | |
| reference: <testLibrary>::@class::A::@constructor::named | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F3 | |
| type: A Function() | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F4 | |
| returnType: A Function() | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_constructorTearOff_genericElementIsSubstituted() async { | |
| var library = await buildLibrary(r''' | |
| class A<T> { | |
| const A(); | |
| } | |
| typedef TA<T> = A<T>; | |
| const inferred = TA.new; | |
| const explicit = TA<int>.new; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| constructors | |
| #F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:21) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 21 | |
| typeAliases | |
| #F4 TA (nameOffset:36) (firstTokenOffset:28) (offset:36) | |
| element: <testLibrary>::@typeAlias::TA | |
| typeParameters | |
| #F5 T (nameOffset:39) (firstTokenOffset:39) (offset:39) | |
| element: #E1 T | |
| topLevelVariables | |
| #F6 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic inferred (nameOffset:57) (firstTokenOffset:57) (offset:57) | |
| element: <testLibrary>::@topLevelVariable::inferred | |
| initializer: expression_0 | |
| ConstructorTearOff | |
| typeReference: ConstructorTypeReference | |
| name: TA @68 | |
| element: <testLibrary>::@typeAlias::TA | |
| type: A<dynamic> | |
| alias: <testLibrary>::@typeAlias::TA | |
| typeArguments | |
| dynamic | |
| selector: ConstructorSelector | |
| period: . @70 | |
| name2: new @71 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::A::@constructor::new | |
| substitution: {T: T} | |
| staticType: A<T> Function<T>() | |
| inducedGetter: #F7 | |
| #F8 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic explicit (nameOffset:82) (firstTokenOffset:82) (offset:82) | |
| element: <testLibrary>::@topLevelVariable::explicit | |
| initializer: expression_1 | |
| ConstructorTearOff | |
| typeReference: ConstructorTypeReference | |
| name: TA @93 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @95 | |
| arguments | |
| NamedType | |
| name: int @96 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @99 | |
| element: <testLibrary>::@typeAlias::TA | |
| type: A<int> | |
| alias: <testLibrary>::@typeAlias::TA | |
| typeArguments | |
| int | |
| selector: ConstructorSelector | |
| period: . @100 | |
| name2: new @101 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::A::@constructor::new | |
| substitution: {T: int} | |
| staticType: A<int> Function() | |
| inducedGetter: #F9 | |
| getters | |
| #F7 isComplete isOriginVariable isStatic inferred (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57) | |
| element: <testLibrary>::@getter::inferred | |
| inducingVariable: #F6 | |
| #F9 isComplete isOriginVariable isStatic explicit (nameOffset:<null>) (firstTokenOffset:<null>) (offset:82) | |
| element: <testLibrary>::@getter::explicit | |
| inducingVariable: #F8 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F3 | |
| typeAliases | |
| isSimplyBounded TA | |
| reference: <testLibrary>::@typeAlias::TA | |
| firstFragment: #F4 | |
| typeParameters | |
| #E1 T | |
| firstFragment: #F5 | |
| aliasedType: A<T> | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer inferred | |
| reference: <testLibrary>::@topLevelVariable::inferred | |
| firstFragment: #F6 | |
| type: A<T> Function<T>() | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::inferred | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer explicit | |
| reference: <testLibrary>::@topLevelVariable::explicit | |
| firstFragment: #F8 | |
| type: A<int> Function() | |
| constantInitializer | |
| fragment: #F8 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::explicit | |
| getters | |
| isOriginVariable isStatic inferred | |
| reference: <testLibrary>::@getter::inferred | |
| firstFragment: #F7 | |
| returnType: A<T> Function<T>() | |
| variable: <testLibrary>::@topLevelVariable::inferred | |
| isOriginVariable isStatic explicit | |
| reference: <testLibrary>::@getter::explicit | |
| firstFragment: #F9 | |
| returnType: A<int> Function() | |
| variable: <testLibrary>::@topLevelVariable::explicit | |
| '''); | |
| } | |
| test_const_dotShorthand_constructor_explicit() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A(); | |
| } | |
| const A a = const .new(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| topLevelVariables | |
| #F3 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:34) (firstTokenOffset:34) (offset:34) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| DotShorthandConstructorInvocation2 | |
| constKeyword: const @38 | |
| period: . @44 | |
| name: new @45 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @48 | |
| rightParenthesis: ) @49 | |
| shorthandContext: ValidDotShorthandContextResolution | |
| contextType: A | |
| lookupType: A | |
| element: <testLibrary>::@class::A::@constructor::new | |
| staticType: A | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F3 | |
| type: A | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F4 | |
| returnType: A | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_dotShorthand_constructor_implicit() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A(); | |
| } | |
| const A a = .new(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| topLevelVariables | |
| #F3 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:34) (firstTokenOffset:34) (offset:34) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| DotShorthandConstructorInvocation2 | |
| period: . @38 | |
| name: new @39 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @42 | |
| rightParenthesis: ) @43 | |
| shorthandContext: ValidDotShorthandContextResolution | |
| contextType: A | |
| lookupType: A | |
| element: <testLibrary>::@class::A::@constructor::new | |
| staticType: A | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F3 | |
| type: A | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F4 | |
| returnType: A | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_dotShorthand_invalid_methodInvocation() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| static A method() => A(); | |
| } | |
| const A a = .method(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| methods | |
| #F3 isComplete isOriginDeclaration isStatic method (nameOffset:21) (firstTokenOffset:12) (offset:21) | |
| element: <testLibrary>::@class::A::@method::method | |
| topLevelVariables | |
| #F4 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:49) (firstTokenOffset:49) (offset:49) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| DotShorthandMethodInvocation | |
| period: . @53 | |
| name: method @54 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @60 | |
| rightParenthesis: ) @61 | |
| shorthandContext: ValidDotShorthandContextResolution | |
| contextType: A | |
| lookupType: A | |
| resolution: ExecutableInvocationResolution | |
| element: <testLibrary>::@class::A::@method::method | |
| invokeType: A Function() | |
| type: A | |
| staticType: A | |
| inducedGetter: #F5 | |
| getters | |
| #F5 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F4 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration isStatic method | |
| reference: <testLibrary>::@class::A::@method::method | |
| firstFragment: #F3 | |
| returnType: A | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F4 | |
| type: A | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F5 | |
| returnType: A | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_dotShorthand_property() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| static const A a = A(); | |
| const A(); | |
| } | |
| const A a = .a; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| fields | |
| #F2 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:27) (firstTokenOffset:27) (offset:27) | |
| element: <testLibrary>::@class::A::@field::a | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: A @31 | |
| element: <testLibrary>::@class::A | |
| type: A | |
| element: <testLibrary>::@class::A::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @32 | |
| rightParenthesis: ) @33 | |
| staticType: A | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:38) (offset:44) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 44 | |
| getters | |
| #F3 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:27) | |
| element: <testLibrary>::@class::A::@getter::a | |
| inducingVariable: #F2 | |
| topLevelVariables | |
| #F5 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:60) (firstTokenOffset:60) (offset:60) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_1 | |
| DotShorthandNameExpression | |
| period: . @64 | |
| name: a @65 | |
| shorthandContext: ValidDotShorthandContextResolution | |
| contextType: A | |
| lookupType: A | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::A::@getter::a | |
| invokeType: A Function() | |
| type: A | |
| staticType: A | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| fields | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@class::A::@field::a | |
| firstFragment: #F2 | |
| type: A | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::A::@getter::a | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@class::A::@getter::a | |
| firstFragment: #F3 | |
| returnType: A | |
| variable: <testLibrary>::@class::A::@field::a | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F5 | |
| type: A | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F6 | |
| returnType: A | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_extensionOverride_assignment() async { | |
| var library = await buildLibrary(r''' | |
| extension E<T> on T {} | |
| const value = E<int>(0) ??= 1; | |
| '''); | |
| assertResolvedNodeText( | |
| library.getTopLevelVariable('value')!.constantInitializer2!, | |
| r''' | |
| IfNullAssignment | |
| target: InvalidExtensionOverrideAssignmentTarget | |
| extensionOverride: ExtensionOverride2 | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| typeArgumentTypes | |
| int | |
| read: InvalidReadResolution | |
| write: InvalidWriteResolution | |
| operator: ??= | |
| value: IntegerLiteral | |
| literal: 1 | |
| correspondingParameter: <null> | |
| staticType: int | |
| staticType: dynamic | |
| V1: AssignmentExpression | |
| leftHandSide: ExtensionOverride | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| staticType: dynamic | |
| typeArgumentTypes | |
| int | |
| operator: ??= | |
| rightHandSide: IntegerLiteral | |
| literal: 1 | |
| correspondingParameter: <null> | |
| staticType: int | |
| readElement: <null> | |
| readType: dynamic | |
| writeElement: <null> | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: dynamic | |
| ''', | |
| ); | |
| } | |
| test_const_extensionOverride_cascade() async { | |
| var library = await buildLibrary(r''' | |
| extension E<T> on T { | |
| T get value => this; | |
| } | |
| const value = E<int>(0)..value; | |
| '''); | |
| assertResolvedNodeText( | |
| library.getTopLevelVariable('value')!.constantInitializer2!, | |
| r''' | |
| CascadeExpression | |
| target2: InvalidExtensionOverrideExpression | |
| extensionOverride: ExtensionOverride2 | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| typeArgumentTypes | |
| int | |
| staticType: InvalidType | |
| target(v1): ExtensionOverride | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| staticType: dynamic | |
| typeArgumentTypes | |
| int | |
| sections | |
| CascadeSection | |
| operator: .. | |
| body: CascadePropertyExtraction | |
| name: value | |
| resolution: GetterInvocationResolution | |
| element: SubstitutedGetterElementImpl | |
| baseElement: <testLibrary>::@extension::E::@getter::value | |
| substitution: {T: int} | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| cascadeSections | |
| PropertyAccess | |
| operator: .. | |
| propertyName: SimpleIdentifier | |
| token: value | |
| element: SubstitutedGetterElementImpl | |
| baseElement: <testLibrary>::@extension::E::@getter::value | |
| substitution: {T: int} | |
| staticType: int | |
| staticType: int | |
| staticType: InvalidType | |
| ''', | |
| ); | |
| } | |
| test_const_extensionOverride_value() async { | |
| var library = await buildLibrary(r''' | |
| extension E<T> on T {} | |
| const value = E<int>(0); | |
| '''); | |
| assertResolvedNodeText( | |
| library.getTopLevelVariable('value')!.constantInitializer2!, | |
| r''' | |
| InvalidExtensionOverrideExpression | |
| extensionOverride: ExtensionOverride2 | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| typeArgumentTypes | |
| int | |
| staticType: InvalidType | |
| V1: ExtensionOverride | |
| name: E | |
| typeArguments: TypeArgumentList | |
| leftBracket: < | |
| arguments | |
| NamedType | |
| name: int | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > | |
| argumentList: ArgumentList | |
| leftParenthesis: ( | |
| arguments | |
| IntegerLiteral | |
| literal: 0 | |
| correspondingParameter: <null> | |
| staticType: int | |
| rightParenthesis: ) | |
| element: <testLibrary>::@extension::E | |
| extendedType: int | |
| staticType: dynamic | |
| typeArgumentTypes | |
| int | |
| ''', | |
| ); | |
| } | |
| test_const_finalField_hasConstConstructor() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| final int f = 42; | |
| const C(); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasInitializer isFinal isOriginDeclaration f (nameOffset:22) (firstTokenOffset:22) (offset:22) | |
| element: <testLibrary>::@class::C::@field::f | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 42 @26 | |
| staticType: int | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:32) (offset:38) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 38 | |
| getters | |
| #F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:22) | |
| element: <testLibrary>::@class::C::@getter::f | |
| inducingVariable: #F2 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasInitializer isFinal isOriginDeclaration f | |
| reference: <testLibrary>::@class::C::@field::f | |
| firstFragment: #F2 | |
| type: int | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::f | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable f | |
| reference: <testLibrary>::@class::C::@getter::f | |
| firstFragment: #F3 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f | |
| '''); | |
| } | |
| test_const_functionCallTearOff() async { | |
| var library = await buildLibrary(r''' | |
| int f(String value) => 0; | |
| const v = (f).call; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: ParenthesizedExpression | |
| leftParenthesis: ( @36 | |
| expression2: UnqualifiedNameExpression | |
| name: f @37 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::f | |
| type: int Function(String) | |
| staticType: int Function(String) | |
| expression(v1): SimpleIdentifier | |
| token: f @37 | |
| element: <testLibrary>::@function::f | |
| staticType: int Function(String) | |
| rightParenthesis: ) @38 | |
| staticType: int Function(String) | |
| operator: . @39 | |
| name: call @40 | |
| resolution: FunctionCallTearOffResolution | |
| type: int Function(String) | |
| associatedFunctionType: int Function(String) | |
| staticType: int Function(String) | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic f (nameOffset:4) (firstTokenOffset:0) (offset:4) | |
| element: <testLibrary>::@function::f | |
| formalParameters | |
| #F4 requiredPositional isOriginDeclaration value (nameOffset:13) (firstTokenOffset:6) (offset:13) | |
| element: <testLibrary>::@function::f::@formalParameter::value | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int Function(String) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int Function(String) | |
| variable: <testLibrary>::@topLevelVariable::v | |
| functions | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@function::f | |
| firstFragment: #F3 | |
| formalParameters | |
| #E0 requiredPositional value | |
| firstFragment: #F4 | |
| type: String | |
| returnType: int | |
| '''); | |
| } | |
| test_const_functionExpression_typeArgumentTypes() async { | |
| var library = await buildLibrary(r''' | |
| void f<T>(T a) {} | |
| const void Function(int) v = f; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:44) (firstTokenOffset:44) (offset:44) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ImplicitFunctionInstantiation | |
| operand: UnqualifiedNameExpression | |
| name: f @48 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::f | |
| type: void Function<T>(T) | |
| staticType: void Function<T>(T) | |
| staticType: void Function(int) | |
| typeArgumentTypes | |
| int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:44) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic f (nameOffset:5) (firstTokenOffset:0) (offset:5) | |
| element: <testLibrary>::@function::f | |
| typeParameters | |
| #F4 T (nameOffset:7) (firstTokenOffset:7) (offset:7) | |
| element: #E0 T | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration a (nameOffset:12) (firstTokenOffset:10) (offset:12) | |
| element: <testLibrary>::@function::f::@formalParameter::a | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: void Function(int) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: void Function(int) | |
| variable: <testLibrary>::@topLevelVariable::v | |
| functions | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@function::f | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 requiredPositional a | |
| firstFragment: #F5 | |
| type: T | |
| returnType: void | |
| '''); | |
| } | |
| test_const_functionInstantiation_implicitCallTearOff() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C(); | |
| T call<T>(T value) => value; | |
| } | |
| const f = C()<int>; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 18 | |
| methods | |
| #F3 isComplete isOriginDeclaration call (nameOffset:27) (firstTokenOffset:25) (offset:27) | |
| element: <testLibrary>::@class::C::@method::call | |
| typeParameters | |
| #F4 T (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: #E0 T | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration value (nameOffset:37) (firstTokenOffset:35) (offset:37) | |
| element: <testLibrary>::@class::C::@method::call::@formalParameter::value | |
| topLevelVariables | |
| #F6 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic f (nameOffset:62) (firstTokenOffset:62) (offset:62) | |
| element: <testLibrary>::@topLevelVariable::f | |
| initializer: expression_0 | |
| FunctionInstantiation | |
| operand: ImplicitCallTearOff | |
| operand: ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @66 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| element: <testLibrary>::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @67 | |
| rightParenthesis: ) @68 | |
| staticType: C | |
| element: <testLibrary>::@class::C::@method::call | |
| staticType: T Function<T>(T) | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @69 | |
| arguments | |
| NamedType | |
| name: int @70 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @73 | |
| staticType: int Function(int) | |
| typeArgumentTypes | |
| int | |
| inducedGetter: #F7 | |
| getters | |
| #F7 isComplete isOriginVariable isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:62) | |
| element: <testLibrary>::@getter::f | |
| inducingVariable: #F6 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration call | |
| reference: <testLibrary>::@class::C::@method::call | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 requiredPositional value | |
| firstFragment: #F5 | |
| type: T | |
| returnType: T | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer f | |
| reference: <testLibrary>::@topLevelVariable::f | |
| firstFragment: #F6 | |
| type: int Function(int) | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::f | |
| getters | |
| isOriginVariable isStatic f | |
| reference: <testLibrary>::@getter::f | |
| firstFragment: #F7 | |
| returnType: int Function(int) | |
| variable: <testLibrary>::@topLevelVariable::f | |
| '''); | |
| } | |
| test_const_functionInterfaceCallTearOff() async { | |
| var library = await buildLibrary(r''' | |
| int f(String value) => 0; | |
| const Function untyped = f; | |
| const v = (untyped).call; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic untyped (nameOffset:41) (firstTokenOffset:41) (offset:41) | |
| element: <testLibrary>::@topLevelVariable::untyped | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: f @51 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::f | |
| type: int Function(String) | |
| staticType: int Function(String) | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:60) (firstTokenOffset:60) (offset:60) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_1 | |
| ReceiverPropertyExtraction | |
| receiver: ParenthesizedExpression | |
| leftParenthesis: ( @64 | |
| expression2: UnqualifiedNameExpression | |
| name: untyped @65 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::untyped | |
| invokeType: Function Function() | |
| type: Function | |
| staticType: Function | |
| expression(v1): SimpleIdentifier | |
| token: untyped @65 | |
| element: <testLibrary>::@getter::untyped | |
| staticType: Function | |
| rightParenthesis: ) @72 | |
| staticType: Function | |
| operator: . @73 | |
| name: call @74 | |
| resolution: FunctionInterfaceCallTearOffResolution | |
| type: Function | |
| staticType: Function | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic untyped (nameOffset:<null>) (firstTokenOffset:<null>) (offset:41) | |
| element: <testLibrary>::@getter::untyped | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:60) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F3 | |
| functions | |
| #F5 isComplete isOriginDeclaration isStatic f (nameOffset:4) (firstTokenOffset:0) (offset:4) | |
| element: <testLibrary>::@function::f | |
| formalParameters | |
| #F6 requiredPositional isOriginDeclaration value (nameOffset:13) (firstTokenOffset:6) (offset:13) | |
| element: <testLibrary>::@function::f::@formalParameter::value | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic untyped | |
| reference: <testLibrary>::@topLevelVariable::untyped | |
| firstFragment: #F1 | |
| type: Function | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::untyped | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F3 | |
| type: Function | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic untyped | |
| reference: <testLibrary>::@getter::untyped | |
| firstFragment: #F2 | |
| returnType: Function | |
| variable: <testLibrary>::@topLevelVariable::untyped | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F4 | |
| returnType: Function | |
| variable: <testLibrary>::@topLevelVariable::v | |
| functions | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@function::f | |
| firstFragment: #F5 | |
| formalParameters | |
| #E0 requiredPositional value | |
| firstFragment: #F6 | |
| type: String | |
| returnType: int | |
| '''); | |
| } | |
| test_const_functionReference() async { | |
| var library = await buildLibrary(r''' | |
| void f<T>(T a) {} | |
| const v = f<int>; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| FunctionInstantiation | |
| operand: UnqualifiedNameExpression | |
| name: f @28 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::f | |
| type: void Function<T>(T) | |
| staticType: void Function<T>(T) | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @29 | |
| arguments | |
| NamedType | |
| name: int @30 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @33 | |
| staticType: void Function(int) | |
| typeArgumentTypes | |
| int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic f (nameOffset:5) (firstTokenOffset:0) (offset:5) | |
| element: <testLibrary>::@function::f | |
| typeParameters | |
| #F4 T (nameOffset:7) (firstTokenOffset:7) (offset:7) | |
| element: #E0 T | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration a (nameOffset:12) (firstTokenOffset:10) (offset:12) | |
| element: <testLibrary>::@function::f::@formalParameter::a | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: void Function(int) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: void Function(int) | |
| variable: <testLibrary>::@topLevelVariable::v | |
| functions | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@function::f | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 requiredPositional a | |
| firstFragment: #F5 | |
| type: T | |
| returnType: void | |
| '''); | |
| } | |
| test_const_implicitCallTearOff() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C(); | |
| int call(int value) => value; | |
| } | |
| const int Function(int) f = C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 18 | |
| methods | |
| #F3 isComplete isOriginDeclaration call (nameOffset:29) (firstTokenOffset:25) (offset:29) | |
| element: <testLibrary>::@class::C::@method::call | |
| formalParameters | |
| #F4 requiredPositional isOriginDeclaration value (nameOffset:38) (firstTokenOffset:34) (offset:38) | |
| element: <testLibrary>::@class::C::@method::call::@formalParameter::value | |
| topLevelVariables | |
| #F5 hasInitializer isConst isOriginDeclaration isStatic f (nameOffset:81) (firstTokenOffset:81) (offset:81) | |
| element: <testLibrary>::@topLevelVariable::f | |
| initializer: expression_0 | |
| ImplicitCallTearOff | |
| operand: ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @85 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| element: <testLibrary>::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @86 | |
| rightParenthesis: ) @87 | |
| staticType: C | |
| element: <testLibrary>::@class::C::@method::call | |
| staticType: int Function(int) | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:81) | |
| element: <testLibrary>::@getter::f | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration call | |
| reference: <testLibrary>::@class::C::@method::call | |
| firstFragment: #F3 | |
| formalParameters | |
| #E0 requiredPositional value | |
| firstFragment: #F4 | |
| type: int | |
| returnType: int | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@topLevelVariable::f | |
| firstFragment: #F5 | |
| type: int Function(int) | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::f | |
| getters | |
| isOriginVariable isStatic f | |
| reference: <testLibrary>::@getter::f | |
| firstFragment: #F6 | |
| returnType: int Function(int) | |
| variable: <testLibrary>::@topLevelVariable::f | |
| '''); | |
| } | |
| test_const_implicitCallTearOff_generic() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C(); | |
| T call<T>(T value) => value; | |
| } | |
| const int Function(int) f = C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 18 | |
| methods | |
| #F3 isComplete isOriginDeclaration call (nameOffset:27) (firstTokenOffset:25) (offset:27) | |
| element: <testLibrary>::@class::C::@method::call | |
| typeParameters | |
| #F4 T (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: #E0 T | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration value (nameOffset:37) (firstTokenOffset:35) (offset:37) | |
| element: <testLibrary>::@class::C::@method::call::@formalParameter::value | |
| topLevelVariables | |
| #F6 hasInitializer isConst isOriginDeclaration isStatic f (nameOffset:80) (firstTokenOffset:80) (offset:80) | |
| element: <testLibrary>::@topLevelVariable::f | |
| initializer: expression_0 | |
| ImplicitFunctionInstantiation | |
| operand: ImplicitCallTearOff | |
| operand: ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @84 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| element: <testLibrary>::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @85 | |
| rightParenthesis: ) @86 | |
| staticType: C | |
| element: <testLibrary>::@class::C::@method::call | |
| staticType: T Function<T>(T) | |
| staticType: int Function(int) | |
| typeArgumentTypes | |
| int | |
| inducedGetter: #F7 | |
| getters | |
| #F7 isComplete isOriginVariable isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80) | |
| element: <testLibrary>::@getter::f | |
| inducingVariable: #F6 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration call | |
| reference: <testLibrary>::@class::C::@method::call | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 requiredPositional value | |
| firstFragment: #F5 | |
| type: T | |
| returnType: T | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@topLevelVariable::f | |
| firstFragment: #F6 | |
| type: int Function(int) | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::f | |
| getters | |
| isOriginVariable isStatic f | |
| reference: <testLibrary>::@getter::f | |
| firstFragment: #F7 | |
| returnType: int Function(int) | |
| variable: <testLibrary>::@topLevelVariable::f | |
| '''); | |
| } | |
| test_const_implicitFunctionInstantiation_constructor() async { | |
| var library = await buildLibrary(r''' | |
| class C<T> { | |
| C(T value); | |
| } | |
| const C<int> Function(int) f = C.new; | |
| '''); | |
| assertResolvedNodeText( | |
| library.getTopLevelVariable('f')!.constantInitializer2!, | |
| r''' | |
| ImplicitFunctionInstantiation | |
| operand: ConstructorTearOff | |
| typeReference: ConstructorTypeReference | |
| name: C | |
| element: <testLibrary>::@class::C | |
| type: C<dynamic> | |
| selector: ConstructorSelector | |
| period: . | |
| name2: new | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {T: T} | |
| staticType: C<T> Function<T>(T) | |
| staticType: C<int> Function(int) | |
| typeArgumentTypes | |
| int | |
| V1: ConstructorReference | |
| constructorName: ConstructorName | |
| type: NamedType | |
| name: C | |
| element: <testLibrary>::@class::C | |
| type: null | |
| period: . | |
| name: SimpleIdentifier | |
| token: new | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {T: int} | |
| staticType: null | |
| tearOffTypeArgumentTypes | |
| int | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {T: int} | |
| staticType: C<int> Function(int) | |
| ''', | |
| ); | |
| } | |
| test_const_implicitFunctionInstantiation_legacy() async { | |
| var library = await buildLibrary(r''' | |
| // %before-language-feature: constructor-tearoffs | |
| T id<T>(T value) => value; | |
| const int Function(int) f = id; | |
| '''); | |
| assertResolvedNodeText( | |
| library.getTopLevelVariable('f')!.constantInitializer2!, | |
| r''' | |
| ImplicitFunctionInstantiation | |
| operand: UnqualifiedNameExpression | |
| name: id | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::id | |
| type: T Function<T>(T) | |
| staticType: T Function<T>(T) | |
| staticType: int Function(int) | |
| typeArgumentTypes | |
| int | |
| V1: SimpleIdentifier | |
| token: id | |
| element: <testLibrary>::@function::id | |
| staticType: int Function(int) | |
| tearOffTypeArgumentTypes | |
| int | |
| ''', | |
| ); | |
| } | |
| test_const_indexExpression() async { | |
| var library = await buildLibrary(r''' | |
| const a = [0]; | |
| const b = 0; | |
| const c = a[b]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ListLiteral | |
| leftBracket: [ @10 | |
| elements2 | |
| IntegerLiteral | |
| literal: 0 @11 | |
| staticType: int | |
| rightBracket: ] @12 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:21) (firstTokenOffset:21) (offset:21) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| IntegerLiteral | |
| literal: 0 @25 | |
| staticType: int | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic c (nameOffset:34) (firstTokenOffset:34) (offset:34) | |
| element: <testLibrary>::@topLevelVariable::c | |
| initializer: expression_2 | |
| ReceiverIndexExpression | |
| receiver: UnqualifiedNameExpression | |
| name: a @38 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: List<int> Function() | |
| type: List<int> | |
| staticType: List<int> | |
| leftBracket: [ @39 | |
| index: UnqualifiedNameExpression | |
| name: b @40 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::b | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| rightBracket: ] @41 | |
| resolution: MethodIndexReadResolution | |
| element: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[] | |
| substitution: {E: int} | |
| invokeType: int Function(int) | |
| type: int | |
| staticType: int | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:34) | |
| element: <testLibrary>::@getter::c | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: List<int> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@topLevelVariable::c | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::c | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: List<int> | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@getter::c | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::c | |
| '''); | |
| } | |
| test_const_indexExpression_nullAware() async { | |
| var library = await buildLibrary(r''' | |
| const List<int>? a = [0]; | |
| const b = 0; | |
| const c = a?[b]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:17) (firstTokenOffset:17) (offset:17) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ListLiteral | |
| leftBracket: [ @21 | |
| elements2 | |
| IntegerLiteral | |
| literal: 0 @22 | |
| staticType: int | |
| rightBracket: ] @23 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| IntegerLiteral | |
| literal: 0 @36 | |
| staticType: int | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic c (nameOffset:45) (firstTokenOffset:45) (offset:45) | |
| element: <testLibrary>::@topLevelVariable::c | |
| initializer: expression_2 | |
| ReceiverIndexExpression | |
| receiver: UnqualifiedNameExpression | |
| name: a @49 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: List<int>? Function() | |
| type: List<int>? | |
| staticType: List<int>? | |
| question: ? @50 | |
| leftBracket: [ @51 | |
| index: UnqualifiedNameExpression | |
| name: b @52 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::b | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| rightBracket: ] @53 | |
| resolution: MethodIndexReadResolution | |
| element: SubstitutedMethodElementImpl | |
| baseElement: dart:core::@class::List::@method::[] | |
| substitution: {E: int} | |
| invokeType: int Function(int) | |
| type: int? | |
| staticType: int? | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:17) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:45) | |
| element: <testLibrary>::@getter::c | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: List<int>? | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@topLevelVariable::c | |
| firstFragment: #F5 | |
| type: int? | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::c | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: List<int>? | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@getter::c | |
| firstFragment: #F6 | |
| returnType: int? | |
| variable: <testLibrary>::@topLevelVariable::c | |
| '''); | |
| } | |
| test_const_inference_downward_list() async { | |
| var library = await buildLibrary(r''' | |
| class P<T> { | |
| const P(); | |
| } | |
| class P1<T> extends P<T> { | |
| const P1(); | |
| } | |
| class P2<T> extends P<T> { | |
| const P2(); | |
| } | |
| const List<P> values = [P1(), P2<int>()]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class P (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::P | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| constructors | |
| #F3 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:15) (offset:21) | |
| element: <testLibrary>::@class::P::@constructor::new | |
| typeName: P | |
| typeNameOffset: 21 | |
| #F4 hasExtendsClause class P1 (nameOffset:35) (firstTokenOffset:29) (offset:35) | |
| element: <testLibrary>::@class::P1 | |
| typeParameters | |
| #F5 T (nameOffset:38) (firstTokenOffset:38) (offset:38) | |
| element: #E1 T | |
| constructors | |
| #F6 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:58) (offset:64) | |
| element: <testLibrary>::@class::P1::@constructor::new | |
| typeName: P1 | |
| typeNameOffset: 64 | |
| #F7 hasExtendsClause class P2 (nameOffset:79) (firstTokenOffset:73) (offset:79) | |
| element: <testLibrary>::@class::P2 | |
| typeParameters | |
| #F8 T (nameOffset:82) (firstTokenOffset:82) (offset:82) | |
| element: #E2 T | |
| constructors | |
| #F9 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:102) (offset:108) | |
| element: <testLibrary>::@class::P2::@constructor::new | |
| typeName: P2 | |
| typeNameOffset: 108 | |
| topLevelVariables | |
| #F10 hasInitializer isConst isOriginDeclaration isStatic values (nameOffset:131) (firstTokenOffset:131) (offset:131) | |
| element: <testLibrary>::@topLevelVariable::values | |
| initializer: expression_0 | |
| ListLiteral | |
| leftBracket: [ @140 | |
| elements2 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: P1 @141 | |
| element: <testLibrary>::@class::P1 | |
| type: P1<dynamic> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P1::@constructor::new | |
| substitution: {T: dynamic} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @143 | |
| rightParenthesis: ) @144 | |
| staticType: P1<dynamic> | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: P2 @147 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @149 | |
| arguments | |
| NamedType | |
| name: int @150 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @153 | |
| element: <testLibrary>::@class::P2 | |
| type: P2<int> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P2::@constructor::new | |
| substitution: {T: int} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @154 | |
| rightParenthesis: ) @155 | |
| staticType: P2<int> | |
| elements(v1) | |
| InstanceCreationExpression | |
| constructorName: ConstructorName | |
| type: NamedType | |
| name: P1 @141 | |
| element: <testLibrary>::@class::P1 | |
| type: P1<dynamic> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P1::@constructor::new | |
| substitution: {T: dynamic} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @143 | |
| rightParenthesis: ) @144 | |
| staticType: P1<dynamic> | |
| InstanceCreationExpression | |
| constructorName: ConstructorName | |
| type: NamedType | |
| name: P2 @147 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @149 | |
| arguments | |
| NamedType | |
| name: int @150 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @153 | |
| element: <testLibrary>::@class::P2 | |
| type: P2<int> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P2::@constructor::new | |
| substitution: {T: int} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @154 | |
| rightParenthesis: ) @155 | |
| staticType: P2<int> | |
| rightBracket: ] @156 | |
| staticType: List<P<dynamic>> | |
| inducedGetter: #F11 | |
| getters | |
| #F11 isComplete isOriginVariable isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:131) | |
| element: <testLibrary>::@getter::values | |
| inducingVariable: #F10 | |
| classes | |
| isSimplyBounded class P | |
| reference: <testLibrary>::@class::P | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::P::@constructor::new | |
| firstFragment: #F3 | |
| isSimplyBounded class P1 | |
| reference: <testLibrary>::@class::P1 | |
| firstFragment: #F4 | |
| typeParameters | |
| #E1 T | |
| firstFragment: #F5 | |
| supertype: P<T> | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::P1::@constructor::new | |
| firstFragment: #F6 | |
| superConstructor: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P::@constructor::new | |
| substitution: {T: T} | |
| isSimplyBounded class P2 | |
| reference: <testLibrary>::@class::P2 | |
| firstFragment: #F7 | |
| typeParameters | |
| #E2 T | |
| firstFragment: #F8 | |
| supertype: P<T> | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::P2::@constructor::new | |
| firstFragment: #F9 | |
| superConstructor: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::P::@constructor::new | |
| substitution: {T: T} | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic values | |
| reference: <testLibrary>::@topLevelVariable::values | |
| firstFragment: #F10 | |
| type: List<P<dynamic>> | |
| constantInitializer | |
| fragment: #F10 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::values | |
| getters | |
| isOriginVariable isStatic values | |
| reference: <testLibrary>::@getter::values | |
| firstFragment: #F11 | |
| returnType: List<P<dynamic>> | |
| variable: <testLibrary>::@topLevelVariable::values | |
| '''); | |
| } | |
| test_const_invalid_field_const() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const f = 1 + foo(); | |
| } | |
| int foo() => 42; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic f (nameOffset:25) (firstTokenOffset:25) (offset:25) | |
| element: <testLibrary>::@class::C::@field::f | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @29 | |
| staticType: int | |
| operator: + @31 | |
| rightOperand: UnqualifiedFunctionInvocation | |
| name: foo @33 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @36 | |
| rightParenthesis: ) @37 | |
| resolution: ExecutableInvocationResolution | |
| element: <testLibrary>::@function::foo | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25) | |
| element: <testLibrary>::@class::C::@getter::f | |
| inducingVariable: #F2 | |
| functions | |
| #F5 isComplete isOriginDeclaration isStatic foo (nameOffset:47) (firstTokenOffset:43) (offset:47) | |
| element: <testLibrary>::@function::foo | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer f | |
| reference: <testLibrary>::@class::C::@field::f | |
| firstFragment: #F2 | |
| type: int | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::f | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable isStatic f | |
| reference: <testLibrary>::@class::C::@getter::f | |
| firstFragment: #F3 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f | |
| functions | |
| isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F5 | |
| returnType: int | |
| '''); | |
| } | |
| test_const_invalid_field_final() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| final f = 1 + foo(); | |
| } | |
| int foo() => 42; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType hasInitializer isFinal isOriginDeclaration f (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@class::C::@field::f | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@class::C::@getter::f | |
| inducingVariable: #F2 | |
| functions | |
| #F5 isComplete isOriginDeclaration isStatic foo (nameOffset:40) (firstTokenOffset:36) (offset:40) | |
| element: <testLibrary>::@function::foo | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer f | |
| reference: <testLibrary>::@class::C::@field::f | |
| firstFragment: #F2 | |
| type: int | |
| getter: <testLibrary>::@class::C::@getter::f | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable f | |
| reference: <testLibrary>::@class::C::@getter::f | |
| firstFragment: #F3 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::f | |
| functions | |
| isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F5 | |
| returnType: int | |
| '''); | |
| } | |
| test_const_invalid_functionExpression() async { | |
| var library = await buildLibrary(r''' | |
| const v = () { | |
| return 0; | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int Function() | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int Function() | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_assertInitializer() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A() : assert((() => true)()); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| constantInitializers | |
| AssertInitializer | |
| assertKeyword: assert @24 | |
| leftParenthesis: ( @30 | |
| condition2: UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| condition(v1): SimpleIdentifier | |
| token: _notSerializableExpression @-1 | |
| element: <null> | |
| staticType: null | |
| rightParenthesis: ) @45 | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_assertInitializer_message() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A() : assert(b, () => 0); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| constantInitializers | |
| AssertInitializer | |
| assertKeyword: assert @24 | |
| leftParenthesis: ( @30 | |
| condition2: UnqualifiedNameExpression | |
| name: b @31 | |
| resolution: InvalidNamedReadResolution | |
| recoveryElement: <null> | |
| staticType: InvalidType | |
| condition(v1): SimpleIdentifier | |
| token: b @31 | |
| element: <null> | |
| staticType: InvalidType | |
| comma: , @32 | |
| message2: UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| message(v1): SimpleIdentifier | |
| token: _notSerializableExpression @-1 | |
| element: <null> | |
| staticType: null | |
| rightParenthesis: ) @41 | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_constructorFieldInitializer() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| final Object? foo; | |
| const A() : foo = (() => 0); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| fields | |
| #F2 isFinal isOriginDeclaration foo (nameOffset:26) (firstTokenOffset:26) (offset:26) | |
| element: <testLibrary>::@class::A::@field::foo | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:33) (offset:39) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 39 | |
| getters | |
| #F3 isComplete isOriginVariable foo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26) | |
| element: <testLibrary>::@class::A::@getter::foo | |
| inducingVariable: #F2 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| fields | |
| isFinal isOriginDeclaration foo | |
| reference: <testLibrary>::@class::A::@field::foo | |
| firstFragment: #F2 | |
| type: Object? | |
| getter: <testLibrary>::@class::A::@getter::foo | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F4 | |
| constantInitializers | |
| ConstructorFieldInitializer | |
| fieldName2: foo @45 | |
| fieldName(v1): SimpleIdentifier | |
| token: foo @45 | |
| element: <testLibrary>::@class::A::@field::foo | |
| staticType: null | |
| equals: = @49 | |
| expression2: UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| expression(v1): SimpleIdentifier | |
| token: _notSerializableExpression @-1 | |
| element: <null> | |
| staticType: null | |
| fieldElement: <testLibrary>::@class::A::@field::foo | |
| getters | |
| isOriginVariable foo | |
| reference: <testLibrary>::@class::A::@getter::foo | |
| firstFragment: #F3 | |
| returnType: Object? | |
| variable: <testLibrary>::@class::A::@field::foo | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_nested() async { | |
| var library = await buildLibrary(r''' | |
| const v = | |
| () { | |
| return 0; | |
| } + | |
| 2; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_redirectingConstructorInvocation() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A(Object a, Object b); | |
| const A.named() : this(0, () => 0); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| formalParameters | |
| #F3 requiredPositional isOriginDeclaration a (nameOffset:27) (firstTokenOffset:20) (offset:27) | |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a | |
| #F4 requiredPositional isOriginDeclaration b (nameOffset:37) (firstTokenOffset:30) (offset:37) | |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b | |
| #F5 isComplete isConst isOriginDeclaration isRedirecting named (nameOffset:51) (firstTokenOffset:43) (offset:51) | |
| element: <testLibrary>::@class::A::@constructor::named | |
| typeName: A | |
| typeNameOffset: 49 | |
| periodOffset: 50 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| formalParameters | |
| #E0 requiredPositional a | |
| firstFragment: #F3 | |
| type: Object | |
| #E1 requiredPositional b | |
| firstFragment: #F4 | |
| type: Object | |
| isConst isOriginDeclaration isRedirecting named | |
| reference: <testLibrary>::@class::A::@constructor::named | |
| firstFragment: #F5 | |
| constantInitializers | |
| RedirectingConstructorInvocation | |
| thisKeyword: this @61 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @65 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @66 | |
| staticType: int | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| arguments(v1) | |
| IntegerLiteral | |
| literal: 0 @66 | |
| staticType: int | |
| SimpleIdentifier | |
| token: _notSerializableExpression @-1 | |
| element: <null> | |
| staticType: null | |
| rightParenthesis: ) @76 | |
| element: <testLibrary>::@class::A::@constructor::new | |
| redirectedConstructor: <testLibrary>::@class::A::@constructor::new | |
| '''); | |
| } | |
| test_const_invalid_functionExpression_superConstructorInvocation() async { | |
| var library = await buildLibrary(r''' | |
| class A { | |
| const A(Object a, Object b); | |
| } | |
| class B extends A { | |
| const B() : super(0, () => 0); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 18 | |
| formalParameters | |
| #F3 requiredPositional isOriginDeclaration a (nameOffset:27) (firstTokenOffset:20) (offset:27) | |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::a | |
| #F4 requiredPositional isOriginDeclaration b (nameOffset:37) (firstTokenOffset:30) (offset:37) | |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::b | |
| #F5 hasExtendsClause class B (nameOffset:50) (firstTokenOffset:44) (offset:50) | |
| element: <testLibrary>::@class::B | |
| constructors | |
| #F6 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:66) (offset:72) | |
| element: <testLibrary>::@class::B::@constructor::new | |
| typeName: B | |
| typeNameOffset: 72 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| formalParameters | |
| #E0 requiredPositional a | |
| firstFragment: #F3 | |
| type: Object | |
| #E1 requiredPositional b | |
| firstFragment: #F4 | |
| type: Object | |
| isSimplyBounded class B | |
| reference: <testLibrary>::@class::B | |
| firstFragment: #F5 | |
| supertype: A | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::B::@constructor::new | |
| firstFragment: #F6 | |
| constantInitializers | |
| SuperConstructorInvocation | |
| superKeyword: super @78 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @83 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @84 | |
| staticType: int | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| arguments(v1) | |
| IntegerLiteral | |
| literal: 0 @84 | |
| staticType: int | |
| SimpleIdentifier | |
| token: _notSerializableExpression @-1 | |
| element: <null> | |
| staticType: null | |
| rightParenthesis: ) @94 | |
| element: <testLibrary>::@class::A::@constructor::new | |
| superConstructor: <testLibrary>::@class::A::@constructor::new | |
| '''); | |
| } | |
| @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44522') | |
| test_const_invalid_intLiteral() async { | |
| var library = await buildLibrary(r''' | |
| const int x = 0x; | |
| '''); | |
| checkElementText(library, r''' | |
| const int x = 0; | |
| '''); | |
| } | |
| test_const_invalid_methodInvocation() async { | |
| var library = await buildLibrary(r''' | |
| const a = 'abc'.codeUnitAt(0); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ReceiverMethodInvocation | |
| receiver: SimpleStringLiteral | |
| literal: 'abc' @10 | |
| operator: . @15 | |
| name: codeUnitAt @16 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @26 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @27 | |
| staticType: int | |
| rightParenthesis: ) @28 | |
| resolution: ExecutableInvocationResolution | |
| element: dart:core::@class::String::@method::codeUnitAt | |
| invokeType: int Function(int) | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_invalid_patternAssignment() async { | |
| var library = await buildLibrary(r''' | |
| const v = (a,) = (0,); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: (int,) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: (int,) | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_invalid_topLevel() async { | |
| var library = await buildLibrary(r''' | |
| const v = 1 + foo(); | |
| int foo() => 42; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @10 | |
| staticType: int | |
| operator: + @12 | |
| rightOperand: UnqualifiedFunctionInvocation | |
| name: foo @14 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @17 | |
| rightParenthesis: ) @18 | |
| resolution: ExecutableInvocationResolution | |
| element: <testLibrary>::@function::foo | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic foo (nameOffset:25) (firstTokenOffset:21) (offset:25) | |
| element: <testLibrary>::@function::foo | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| functions | |
| isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F3 | |
| returnType: int | |
| '''); | |
| } | |
| test_const_invalid_topLevel_switchExpression() async { | |
| var library = await buildLibrary(r''' | |
| const a = | |
| 0 + | |
| switch (true) { | |
| _ => 1, | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: _notSerializableExpression @-1 | |
| resolution: <null> | |
| staticType: null | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_invalid_typeMismatch() async { | |
| var library = await buildLibrary(r''' | |
| const int a = 0; | |
| const bool b = a + 5; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:10) (firstTokenOffset:10) (offset:10) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @14 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:28) (firstTokenOffset:28) (offset:28) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| BinaryOperatorInvocation | |
| leftOperand: UnqualifiedNameExpression | |
| name: a @32 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| operator: + @34 | |
| rightOperand: IntegerLiteral | |
| literal: 5 @36 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:10) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasInitializer isConst isOriginDeclaration isStatic b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: bool | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_named() async { | |
| var library = await buildLibrary(r''' | |
| class C<K, V> { | |
| const C.named(K k, V v); | |
| } | |
| const V = const C<int, String>.named(1, '222'); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 K (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 K | |
| #F3 V (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: #E1 V | |
| constructors | |
| #F4 isConst isOriginDeclaration named (nameOffset:26) (firstTokenOffset:18) (offset:26) | |
| element: <testLibrary>::@class::C::@constructor::named | |
| typeName: C | |
| typeNameOffset: 24 | |
| periodOffset: 25 | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration k (nameOffset:34) (firstTokenOffset:32) (offset:34) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::k | |
| #F6 requiredPositional isOriginDeclaration v (nameOffset:39) (firstTokenOffset:37) (offset:39) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::v | |
| topLevelVariables | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:52) (firstTokenOffset:52) (offset:52) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @56 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @62 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @63 | |
| arguments | |
| NamedType | |
| name: int @64 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @69 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @75 | |
| element: <testLibrary>::@class::C | |
| type: C<int, String> | |
| selector: ConstructorSelector | |
| period: . @76 | |
| name2: named @77 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::named | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @82 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 1 @83 | |
| staticType: int | |
| SimpleStringLiteral | |
| literal: '222' @86 | |
| rightParenthesis: ) @91 | |
| staticType: C<int, String> | |
| inducedGetter: #F8 | |
| getters | |
| #F8 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F7 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 K | |
| firstFragment: #F2 | |
| #E1 V | |
| firstFragment: #F3 | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration named | |
| reference: <testLibrary>::@class::C::@constructor::named | |
| firstFragment: #F4 | |
| formalParameters | |
| #E2 requiredPositional k | |
| firstFragment: #F5 | |
| type: K | |
| #E3 requiredPositional v | |
| firstFragment: #F6 | |
| type: V | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F7 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F8 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_named_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C<K, V> { | |
| const C.named(K k, V v); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = const C<int, String>.named(1, '222'); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @28 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @34 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @35 | |
| arguments | |
| NamedType | |
| name: int @36 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @41 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @47 | |
| element: package:test/a.dart::@class::C | |
| type: C<int, String> | |
| selector: ConstructorSelector | |
| period: . @48 | |
| name2: named @49 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: package:test/a.dart::@class::C::@constructor::named | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @54 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 1 @55 | |
| staticType: int | |
| SimpleStringLiteral | |
| literal: '222' @58 | |
| rightParenthesis: ) @63 | |
| staticType: C<int, String> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_named_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C<K, V> { | |
| const C.named(K k, V v); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C<int, String>.named(1, '222'); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @42 | |
| arguments | |
| NamedType | |
| name: int @43 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @48 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @54 | |
| element: package:test/a.dart::@class::C | |
| type: C<int, String> | |
| selector: ConstructorSelector | |
| period: . @55 | |
| name2: named @56 | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: package:test/a.dart::@class::C::@constructor::named | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @61 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 1 @62 | |
| staticType: int | |
| SimpleStringLiteral | |
| literal: '222' @65 | |
| rightParenthesis: ) @70 | |
| staticType: C<int, String> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_noTypeArguments() async { | |
| var library = await buildLibrary(r''' | |
| class C<K, V> { | |
| const C(); | |
| } | |
| const V = const C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 K (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 K | |
| #F3 V (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: #E1 V | |
| constructors | |
| #F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:18) (offset:24) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 24 | |
| topLevelVariables | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:38) (firstTokenOffset:38) (offset:38) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @42 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @48 | |
| element: <testLibrary>::@class::C | |
| type: C<dynamic, dynamic> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {K: dynamic, V: dynamic} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @49 | |
| rightParenthesis: ) @50 | |
| staticType: C<dynamic, dynamic> | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 K | |
| firstFragment: #F2 | |
| #E1 V | |
| firstFragment: #F3 | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F5 | |
| type: C<dynamic, dynamic> | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F6 | |
| returnType: C<dynamic, dynamic> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_noTypeArguments_inferred() async { | |
| var library = await buildLibrary(r''' | |
| class A<T> { | |
| final T t; | |
| const A(this.t); | |
| } | |
| const Object a = const A(0); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| fields | |
| #F3 isFinal isOriginDeclaration t (nameOffset:23) (firstTokenOffset:23) (offset:23) | |
| element: <testLibrary>::@class::A::@field::t | |
| inducedGetter: #F4 | |
| constructors | |
| #F5 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:28) (offset:34) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| typeNameOffset: 34 | |
| formalParameters | |
| #F6 requiredPositional hasImplicitType isFinal isOriginDeclaration this.t (nameOffset:41) (firstTokenOffset:36) (offset:41) | |
| element: <testLibrary>::@class::A::@constructor::new::@formalParameter::t | |
| getters | |
| #F4 isComplete isOriginVariable t (nameOffset:<null>) (firstTokenOffset:<null>) (offset:23) | |
| element: <testLibrary>::@class::A::@getter::t | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| #F7 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:61) (firstTokenOffset:61) (offset:61) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @65 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: A @71 | |
| element: <testLibrary>::@class::A | |
| type: A<int> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::A::@constructor::new | |
| substitution: {T: int} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @72 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @73 | |
| staticType: int | |
| rightParenthesis: ) @74 | |
| staticType: A<int> | |
| inducedGetter: #F8 | |
| getters | |
| #F8 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F7 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| fields | |
| hasEnclosingTypeParameterReference isFinal isOriginDeclaration t | |
| reference: <testLibrary>::@class::A::@field::t | |
| firstFragment: #F3 | |
| type: T | |
| getter: <testLibrary>::@class::A::@getter::t | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F5 | |
| formalParameters | |
| #E1 requiredPositional hasImplicitType isFinal this.t | |
| firstFragment: #F6 | |
| type: T | |
| field: <testLibrary>::@class::A::@field::t | |
| getters | |
| hasEnclosingTypeParameterReference isOriginVariable t | |
| reference: <testLibrary>::@class::A::@getter::t | |
| firstFragment: #F4 | |
| returnType: T | |
| variable: <testLibrary>::@class::A::@field::t | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F7 | |
| type: Object | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F8 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_unnamed() async { | |
| var library = await buildLibrary(r''' | |
| class C<K, V> { | |
| const C(); | |
| } | |
| const V = const C<int, String>(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 K (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 K | |
| #F3 V (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: #E1 V | |
| constructors | |
| #F4 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:18) (offset:24) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 24 | |
| topLevelVariables | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:38) (firstTokenOffset:38) (offset:38) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @42 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @48 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @49 | |
| arguments | |
| NamedType | |
| name: int @50 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @55 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @61 | |
| element: <testLibrary>::@class::C | |
| type: C<int, String> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: <testLibrary>::@class::C::@constructor::new | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @62 | |
| rightParenthesis: ) @63 | |
| staticType: C<int, String> | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 K | |
| firstFragment: #F2 | |
| #E1 V | |
| firstFragment: #F3 | |
| constructors | |
| hasEnclosingTypeParameterReference isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F5 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F6 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_unnamed_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C<K, V> { | |
| const C(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = const C<int, String>(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @28 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @34 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @35 | |
| arguments | |
| NamedType | |
| name: int @36 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @41 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @47 | |
| element: package:test/a.dart::@class::C | |
| type: C<int, String> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: package:test/a.dart::@class::C::@constructor::new | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @48 | |
| rightParenthesis: ) @49 | |
| staticType: C<int, String> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_generic_unnamed_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C<K, V> { | |
| const C(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C<int, String>(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @42 | |
| arguments | |
| NamedType | |
| name: int @43 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @48 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @54 | |
| element: package:test/a.dart::@class::C | |
| type: C<int, String> | |
| element: SubstitutedConstructorElementImpl | |
| baseElement: package:test/a.dart::@class::C::@constructor::new | |
| substitution: {K: int, V: String} | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @55 | |
| rightParenthesis: ) @56 | |
| staticType: C<int, String> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C<int, String> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C<int, String> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C.named(bool a, int b, int c, {String d, double e}); | |
| } | |
| const V = const C.named(true, 1, 2, d: 'ccc', e: 3.4); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration named (nameOffset:20) (firstTokenOffset:12) (offset:20) | |
| element: <testLibrary>::@class::C::@constructor::named | |
| typeName: C | |
| typeNameOffset: 18 | |
| periodOffset: 19 | |
| formalParameters | |
| #F3 requiredPositional isOriginDeclaration a (nameOffset:31) (firstTokenOffset:26) (offset:31) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::a | |
| #F4 requiredPositional isOriginDeclaration b (nameOffset:38) (firstTokenOffset:34) (offset:38) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::b | |
| #F5 requiredPositional isOriginDeclaration c (nameOffset:45) (firstTokenOffset:41) (offset:45) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::c | |
| #F6 optionalNamed isOriginDeclaration d (nameOffset:56) (firstTokenOffset:49) (offset:56) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::d | |
| #F7 optionalNamed isOriginDeclaration e (nameOffset:66) (firstTokenOffset:59) (offset:66) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::e | |
| topLevelVariables | |
| #F8 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:80) (firstTokenOffset:80) (offset:80) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @84 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @90 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| selector: ConstructorSelector | |
| period: . @91 | |
| name2: named @92 | |
| element: <testLibrary>::@class::C::@constructor::named | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @97 | |
| arguments2 | |
| BooleanLiteral | |
| literal: true @98 | |
| staticType: bool | |
| IntegerLiteral | |
| literal: 1 @104 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 2 @107 | |
| staticType: int | |
| NamedArgument | |
| name: d @110 | |
| colon: : @111 | |
| argumentExpression2: SimpleStringLiteral | |
| literal: 'ccc' @113 | |
| NamedArgument | |
| name: e @120 | |
| colon: : @121 | |
| argumentExpression2: DoubleLiteral | |
| literal: 3.4 @123 | |
| staticType: double | |
| rightParenthesis: ) @126 | |
| staticType: C | |
| inducedGetter: #F9 | |
| getters | |
| #F9 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:80) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F8 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration named | |
| reference: <testLibrary>::@class::C::@constructor::named | |
| firstFragment: #F2 | |
| formalParameters | |
| #E0 requiredPositional a | |
| firstFragment: #F3 | |
| type: bool | |
| #E1 requiredPositional b | |
| firstFragment: #F4 | |
| type: int | |
| #E2 requiredPositional c | |
| firstFragment: #F5 | |
| type: int | |
| #E3 optionalNamed d | |
| firstFragment: #F6 | |
| type: String | |
| #E4 optionalNamed e | |
| firstFragment: #F7 | |
| type: double | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F8 | |
| type: C | |
| constantInitializer | |
| fragment: #F8 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F9 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| const C.named(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = const C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @28 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @34 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| selector: ConstructorSelector | |
| period: . @35 | |
| name2: named @36 | |
| element: package:test/a.dart::@class::C::@constructor::named | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @41 | |
| rightParenthesis: ) @42 | |
| staticType: C | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| const C.named(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| selector: ConstructorSelector | |
| period: . @42 | |
| name2: named @43 | |
| element: package:test/a.dart::@class::C::@constructor::named | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @48 | |
| rightParenthesis: ) @49 | |
| staticType: C | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved() async { | |
| var library = await buildLibrary(r''' | |
| class C {} | |
| const V = const C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| topLevelVariables | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @22 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @28 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| selector: ConstructorSelector | |
| period: . @29 | |
| name2: named @30 | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @35 | |
| rightParenthesis: ) @36 | |
| staticType: C | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F3 | |
| type: C | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F4 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved2() async { | |
| var library = await buildLibrary(r''' | |
| const V = const C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @10 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: C @16 | |
| period: . @17 | |
| element: <null> | |
| name: named @18 | |
| element: <null> | |
| type: InvalidType | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @23 | |
| rightParenthesis: ) @24 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved3() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| selector: ConstructorSelector | |
| period: . @42 | |
| name2: named @43 | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @48 | |
| rightParenthesis: ) @49 | |
| staticType: C | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved4() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| element: <null> | |
| type: InvalidType | |
| selector: ConstructorSelector | |
| period: . @42 | |
| name2: named @43 | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @48 | |
| rightParenthesis: ) @49 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved5() async { | |
| var library = await buildLibrary(r''' | |
| const V = const p.C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @10 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @16 | |
| period: . @17 | |
| element: <null> | |
| name: C @18 | |
| element: <null> | |
| type: InvalidType | |
| selector: ConstructorSelector | |
| period: . @19 | |
| name2: named @20 | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @25 | |
| rightParenthesis: ) @26 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_named_unresolved6() async { | |
| var library = await buildLibrary(r''' | |
| class C<T> {} | |
| const V = const C.named(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| constructors | |
| #F3 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| topLevelVariables | |
| #F4 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:21) (firstTokenOffset:21) (offset:21) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @25 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @31 | |
| element: <testLibrary>::@class::C | |
| type: C<dynamic> | |
| selector: ConstructorSelector | |
| period: . @32 | |
| name2: named @33 | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @38 | |
| rightParenthesis: ) @39 | |
| staticType: C<dynamic> | |
| inducedGetter: #F5 | |
| getters | |
| #F5 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F4 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| constructors | |
| hasEnclosingTypeParameterReference isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F4 | |
| type: C<dynamic> | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F5 | |
| returnType: C<dynamic> | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C(); | |
| } | |
| const V = const C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 18 | |
| topLevelVariables | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @36 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @42 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| element: <testLibrary>::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @43 | |
| rightParenthesis: ) @44 | |
| staticType: C | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F3 | |
| type: C | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F4 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| const C(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = const C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @28 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @34 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| element: package:test/a.dart::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @35 | |
| rightParenthesis: ) @36 | |
| staticType: C | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| const C(); | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| element: package:test/a.dart::@class::C::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @42 | |
| rightParenthesis: ) @43 | |
| staticType: C | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: C | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: C | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed_unresolved() async { | |
| var library = await buildLibrary(r''' | |
| const V = const C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @10 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: C @16 | |
| element: <null> | |
| type: InvalidType | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @17 | |
| rightParenthesis: ) @18 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed_unresolved2() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = const p.C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @33 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @39 | |
| period: . @40 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @41 | |
| element: <null> | |
| type: InvalidType | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @42 | |
| rightParenthesis: ) @43 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_invokeConstructor_unnamed_unresolved3() async { | |
| var library = await buildLibrary(r''' | |
| const V = const p.C(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| keyword: const @10 | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| importPrefix: ImportPrefixReference | |
| name: p @16 | |
| period: . @17 | |
| element: <null> | |
| name: C @18 | |
| element: <null> | |
| type: InvalidType | |
| element: <null> | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @19 | |
| rightParenthesis: ) @20 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_isExpression() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = a is int; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| IsExpression | |
| expression2: UnqualifiedNameExpression | |
| name: a @23 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| expression(v1): SimpleIdentifier | |
| token: a @23 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| isOperator: is @25 | |
| type: NamedType | |
| name: int @28 | |
| element: dart:core::@class::int | |
| type: int | |
| staticType: bool | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: bool | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_length_ofClassConstField() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const String F = ''; | |
| } | |
| const int v = C.F.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasInitializer isConst isOriginDeclaration isStatic F (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@class::C::@field::F | |
| initializer: expression_0 | |
| SimpleStringLiteral | |
| literal: '' @36 | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic F (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@class::C::@getter::F | |
| inducingVariable: #F2 | |
| topLevelVariables | |
| #F5 hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:53) (firstTokenOffset:53) (offset:53) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_1 | |
| ReceiverPropertyExtraction | |
| receiver: ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @57 | |
| element: <testLibrary>::@class::C | |
| operator: . @58 | |
| name: F @59 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::C::@getter::F | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @60 | |
| name: length @61 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:53) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasInitializer isConst isOriginDeclaration isStatic F | |
| reference: <testLibrary>::@class::C::@field::F | |
| firstFragment: #F2 | |
| type: String | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::F | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable isStatic F | |
| reference: <testLibrary>::@class::C::@getter::F | |
| firstFragment: #F3 | |
| returnType: String | |
| variable: <testLibrary>::@class::C::@field::F | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofClassConstField_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static const String F = ''; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const int v = C.F.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:28) (firstTokenOffset:28) (offset:28) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @32 | |
| element: package:test/a.dart::@class::C | |
| operator: . @33 | |
| name: F @34 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@class::C::@getter::F | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @35 | |
| name: length @36 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:28) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofClassConstField_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static const String F = ''; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const int v = p.C.F.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:33) (firstTokenOffset:33) (offset:33) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| importPrefix: ImportPrefixReference | |
| name: p @37 | |
| period: . @38 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @39 | |
| element: package:test/a.dart::@class::C | |
| operator: . @40 | |
| name: F @41 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@class::C::@getter::F | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @42 | |
| name: length @43 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:33) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofStringLiteral() async { | |
| var library = await buildLibrary(r''' | |
| const v = 'abc'.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: SimpleStringLiteral | |
| literal: 'abc' @10 | |
| operator: . @15 | |
| name: length @16 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofTopLevelVariable() async { | |
| var library = await buildLibrary(r''' | |
| const String S = 'abc'; | |
| const v = S.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic S (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::S | |
| initializer: expression_0 | |
| SimpleStringLiteral | |
| literal: 'abc' @17 | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:30) (firstTokenOffset:30) (offset:30) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_1 | |
| ReceiverPropertyExtraction | |
| receiver: UnqualifiedNameExpression | |
| name: S @34 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::S | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @35 | |
| name: length @36 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic S (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::S | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:30) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic S | |
| reference: <testLibrary>::@topLevelVariable::S | |
| firstFragment: #F1 | |
| type: String | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::S | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic S | |
| reference: <testLibrary>::@getter::S | |
| firstFragment: #F2 | |
| returnType: String | |
| variable: <testLibrary>::@topLevelVariable::S | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofTopLevelVariable_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| const String S = 'abc'; | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const v = S.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: UnqualifiedNameExpression | |
| name: S @28 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::S | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @29 | |
| name: length @30 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_ofTopLevelVariable_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| const String S = 'abc'; | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const v = p.S.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: ImportPrefixedNameExpression | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: S @35 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::S | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| operator: . @36 | |
| name: length @37 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_length_staticMethod() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static int length() => 42; | |
| } | |
| const v = C.length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| methods | |
| #F3 isComplete isOriginDeclaration isStatic length (nameOffset:23) (firstTokenOffset:12) (offset:23) | |
| element: <testLibrary>::@class::C::@method::length | |
| topLevelVariables | |
| #F4 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:48) (firstTokenOffset:48) (offset:48) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @52 | |
| element: <testLibrary>::@class::C | |
| operator: . @53 | |
| name: length @54 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@class::C::@method::length | |
| type: int Function() | |
| staticType: int Function() | |
| inducedGetter: #F5 | |
| getters | |
| #F5 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F4 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration isStatic length | |
| reference: <testLibrary>::@class::C::@method::length | |
| firstFragment: #F3 | |
| returnType: int | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F4 | |
| type: int Function() | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F5 | |
| returnType: int Function() | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_list_if() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>[if (true) 1]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: [ @28 | |
| elements2 | |
| IfElement | |
| ifKeyword: if @29 | |
| leftParenthesis: ( @32 | |
| expression2: BooleanLiteral | |
| literal: true @33 | |
| staticType: bool | |
| rightParenthesis: ) @37 | |
| thenElement2: IntegerLiteral | |
| literal: 1 @39 | |
| staticType: int | |
| rightBracket: ] @40 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_list_if_else() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>[if (true) 1 else 2]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: [ @28 | |
| elements2 | |
| IfElement | |
| ifKeyword: if @29 | |
| leftParenthesis: ( @32 | |
| expression2: BooleanLiteral | |
| literal: true @33 | |
| staticType: bool | |
| rightParenthesis: ) @37 | |
| thenElement2: IntegerLiteral | |
| literal: 1 @39 | |
| staticType: int | |
| elseKeyword: else @41 | |
| elseElement2: IntegerLiteral | |
| literal: 2 @46 | |
| staticType: int | |
| rightBracket: ] @47 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_list_inferredType() async { | |
| // The summary needs to contain enough information so that when the constant | |
| // is resynthesized, the constant value can get the type that was computed | |
| // by type inference. | |
| var library = await buildLibrary(r''' | |
| const Object x = const [1]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @17 | |
| leftBracket: [ @23 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @24 | |
| staticType: int | |
| rightBracket: ] @25 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_list_spread() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>[ | |
| ...<int>[1], | |
| ]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: [ @28 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ... @32 | |
| expression2: ListLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @35 | |
| arguments | |
| NamedType | |
| name: int @36 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @39 | |
| leftBracket: [ @40 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @41 | |
| staticType: int | |
| rightBracket: ] @42 | |
| staticType: List<int> | |
| rightBracket: ] @45 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_list_spread_null_aware() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>[ | |
| ...?<int>[1], | |
| ]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: [ @28 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ...? @32 | |
| expression2: ListLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @36 | |
| arguments | |
| NamedType | |
| name: int @37 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @40 | |
| leftBracket: [ @41 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @42 | |
| staticType: int | |
| rightBracket: ] @43 | |
| staticType: List<int> | |
| rightBracket: ] @46 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_map_if() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int, int>{if (true) 1: 2}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: int @29 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @32 | |
| leftBracket: { @33 | |
| elements2 | |
| IfElement | |
| ifKeyword: if @34 | |
| leftParenthesis: ( @37 | |
| expression2: BooleanLiteral | |
| literal: true @38 | |
| staticType: bool | |
| rightParenthesis: ) @42 | |
| thenElement2: MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 1 @44 | |
| staticType: int | |
| separator: : @45 | |
| value2: IntegerLiteral | |
| literal: 2 @47 | |
| staticType: int | |
| rightBracket: } @48 | |
| isMap: true | |
| staticType: Map<int, int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_map_inferredType() async { | |
| // The summary needs to contain enough information so that when the constant | |
| // is resynthesized, the constant value can get the type that was computed | |
| // by type inference. | |
| var library = await buildLibrary(r''' | |
| const Object x = const {1: 1.0}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| leftBracket: { @23 | |
| elements2 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 1 @24 | |
| staticType: int | |
| separator: : @25 | |
| value2: DoubleLiteral | |
| literal: 1.0 @27 | |
| staticType: double | |
| rightBracket: } @30 | |
| isMap: true | |
| staticType: Map<int, double> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_map_spread() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int, int>{ | |
| ...<int, int>{1: 2}, | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: int @29 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @32 | |
| leftBracket: { @33 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ... @37 | |
| expression2: SetOrMapLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @40 | |
| arguments | |
| NamedType | |
| name: int @41 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: int @46 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @49 | |
| leftBracket: { @50 | |
| elements2 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 1 @51 | |
| staticType: int | |
| separator: : @52 | |
| value2: IntegerLiteral | |
| literal: 2 @54 | |
| staticType: int | |
| rightBracket: } @55 | |
| isMap: true | |
| staticType: Map<int, int> | |
| rightBracket: } @58 | |
| isMap: true | |
| staticType: Map<int, int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_map_spread_null_aware() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int, int>{ | |
| ...?<int, int>{1: 2}, | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: int @29 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @32 | |
| leftBracket: { @33 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ...? @37 | |
| expression2: SetOrMapLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @41 | |
| arguments | |
| NamedType | |
| name: int @42 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: int @47 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @50 | |
| leftBracket: { @51 | |
| elements2 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 1 @52 | |
| staticType: int | |
| separator: : @53 | |
| value2: IntegerLiteral | |
| literal: 2 @55 | |
| staticType: int | |
| rightBracket: } @56 | |
| isMap: true | |
| staticType: Map<int, int> | |
| rightBracket: } @59 | |
| isMap: true | |
| staticType: Map<int, int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_methodInvocation() async { | |
| var library = await buildLibrary(r''' | |
| T f<T>(T a) => a; | |
| const b = f<int>(0); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_0 | |
| UnqualifiedFunctionInvocation | |
| name: f @28 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @29 | |
| arguments | |
| NamedType | |
| name: int @30 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @33 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @34 | |
| arguments2 | |
| IntegerLiteral | |
| literal: 0 @35 | |
| staticType: int | |
| rightParenthesis: ) @36 | |
| resolution: ExecutableInvocationResolution | |
| element: <testLibrary>::@function::f | |
| invokeType: int Function(int) | |
| type: int | |
| staticType: int | |
| typeArgumentTypes | |
| int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic f (nameOffset:2) (firstTokenOffset:0) (offset:2) | |
| element: <testLibrary>::@function::f | |
| typeParameters | |
| #F4 T (nameOffset:4) (firstTokenOffset:4) (offset:4) | |
| element: #E0 T | |
| formalParameters | |
| #F5 requiredPositional isOriginDeclaration a (nameOffset:9) (firstTokenOffset:7) (offset:9) | |
| element: <testLibrary>::@function::f::@formalParameter::a | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| functions | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@function::f | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 requiredPositional a | |
| firstFragment: #F5 | |
| type: T | |
| returnType: T | |
| '''); | |
| } | |
| test_const_nullAssertionExpression() async { | |
| var library = await buildLibrary(r''' | |
| const int? a = 0; | |
| const b = a!; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @15 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| NullAssertionExpression | |
| operand: UnqualifiedNameExpression | |
| name: a @28 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int? Function() | |
| type: int? | |
| staticType: int? | |
| operator: ! @29 | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int? | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int? | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_parameterDefaultValue_initializingFormal_functionTyped() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| final x; | |
| const C({this.x: foo}); | |
| } | |
| int foo() => 42; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@class::C::@field::x | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 29 | |
| formalParameters | |
| #F5 optionalNamed hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:37) (firstTokenOffset:32) (offset:37) | |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: foo @40 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::foo | |
| type: int Function() | |
| staticType: int Function() | |
| getters | |
| #F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@class::C::@getter::x | |
| inducingVariable: #F2 | |
| functions | |
| #F6 isComplete isOriginDeclaration isStatic foo (nameOffset:54) (firstTokenOffset:50) (offset:54) | |
| element: <testLibrary>::@function::foo | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType isFinal isOriginDeclaration x | |
| reference: <testLibrary>::@class::C::@field::x | |
| firstFragment: #F2 | |
| type: dynamic | |
| getter: <testLibrary>::@class::C::@getter::x | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| formalParameters | |
| #E0 optionalNamed hasDefaultValue hasImplicitType isFinal this.x | |
| firstFragment: #F5 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| field: <testLibrary>::@class::C::@field::x | |
| getters | |
| isOriginVariable x | |
| reference: <testLibrary>::@class::C::@getter::x | |
| firstFragment: #F3 | |
| returnType: dynamic | |
| variable: <testLibrary>::@class::C::@field::x | |
| functions | |
| isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F6 | |
| returnType: int | |
| '''); | |
| } | |
| test_const_parameterDefaultValue_initializingFormal_named() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| final x; | |
| const C({this.x: 1 + 2}); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@class::C::@field::x | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 29 | |
| formalParameters | |
| #F5 optionalNamed hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:37) (firstTokenOffset:32) (offset:37) | |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @40 | |
| staticType: int | |
| operator: + @42 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @44 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| getters | |
| #F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@class::C::@getter::x | |
| inducingVariable: #F2 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType isFinal isOriginDeclaration x | |
| reference: <testLibrary>::@class::C::@field::x | |
| firstFragment: #F2 | |
| type: dynamic | |
| getter: <testLibrary>::@class::C::@getter::x | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| formalParameters | |
| #E0 optionalNamed hasDefaultValue hasImplicitType isFinal this.x | |
| firstFragment: #F5 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| field: <testLibrary>::@class::C::@field::x | |
| getters | |
| isOriginVariable x | |
| reference: <testLibrary>::@class::C::@getter::x | |
| firstFragment: #F3 | |
| returnType: dynamic | |
| variable: <testLibrary>::@class::C::@field::x | |
| '''); | |
| } | |
| test_const_parameterDefaultValue_initializingFormal_positional() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| final x; | |
| const C([this.x = 1 + 2]); | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType isFinal isOriginDeclaration x (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@class::C::@field::x | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isComplete isConst isOriginDeclaration new (nameOffset:<null>) (firstTokenOffset:23) (offset:29) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| typeNameOffset: 29 | |
| formalParameters | |
| #F5 optionalPositional hasImplicitType isFinal isOriginDeclaration this.x (nameOffset:37) (firstTokenOffset:32) (offset:37) | |
| element: <testLibrary>::@class::C::@constructor::new::@formalParameter::x | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @41 | |
| staticType: int | |
| operator: + @43 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @45 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| getters | |
| #F3 isComplete isOriginVariable x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@class::C::@getter::x | |
| inducingVariable: #F2 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType isFinal isOriginDeclaration x | |
| reference: <testLibrary>::@class::C::@field::x | |
| firstFragment: #F2 | |
| type: dynamic | |
| getter: <testLibrary>::@class::C::@getter::x | |
| constructors | |
| isConst isOriginDeclaration new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| formalParameters | |
| #E0 optionalPositional hasDefaultValue hasImplicitType isFinal this.x | |
| firstFragment: #F5 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| field: <testLibrary>::@class::C::@field::x | |
| getters | |
| isOriginVariable x | |
| reference: <testLibrary>::@class::C::@getter::x | |
| firstFragment: #F3 | |
| returnType: dynamic | |
| variable: <testLibrary>::@class::C::@field::x | |
| '''); | |
| } | |
| test_const_parameterDefaultValue_normal() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| const C.positional([p = 1 + 2]); | |
| const C.named({p: 1 + 2}); | |
| void methodPositional([p = 1 + 2]) {} | |
| void methodPositionalWithoutDefault([p]) {} | |
| void methodNamed({p: 1 + 2}) {} | |
| void methodNamedWithoutDefault({p}) {} | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isConst isOriginDeclaration positional (nameOffset:20) (firstTokenOffset:12) (offset:20) | |
| element: <testLibrary>::@class::C::@constructor::positional | |
| typeName: C | |
| typeNameOffset: 18 | |
| periodOffset: 19 | |
| formalParameters | |
| #F3 optionalPositional hasImplicitType isOriginDeclaration p (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@class::C::@constructor::positional::@formalParameter::p | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @36 | |
| staticType: int | |
| operator: + @38 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @40 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| #F4 isConst isOriginDeclaration named (nameOffset:55) (firstTokenOffset:47) (offset:55) | |
| element: <testLibrary>::@class::C::@constructor::named | |
| typeName: C | |
| typeNameOffset: 53 | |
| periodOffset: 54 | |
| formalParameters | |
| #F5 optionalNamed hasImplicitType isOriginDeclaration p (nameOffset:62) (firstTokenOffset:62) (offset:62) | |
| element: <testLibrary>::@class::C::@constructor::named::@formalParameter::p | |
| initializer: expression_1 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @65 | |
| staticType: int | |
| operator: + @67 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @69 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| methods | |
| #F6 isComplete isOriginDeclaration methodPositional (nameOffset:81) (firstTokenOffset:76) (offset:81) | |
| element: <testLibrary>::@class::C::@method::methodPositional | |
| formalParameters | |
| #F7 optionalPositional hasImplicitType isOriginDeclaration p (nameOffset:99) (firstTokenOffset:99) (offset:99) | |
| element: <testLibrary>::@class::C::@method::methodPositional::@formalParameter::p | |
| initializer: expression_2 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @103 | |
| staticType: int | |
| operator: + @105 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @107 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| #F8 isComplete isOriginDeclaration methodPositionalWithoutDefault (nameOffset:121) (firstTokenOffset:116) (offset:121) | |
| element: <testLibrary>::@class::C::@method::methodPositionalWithoutDefault | |
| formalParameters | |
| #F9 optionalPositional hasImplicitType isOriginDeclaration p (nameOffset:153) (firstTokenOffset:153) (offset:153) | |
| element: <testLibrary>::@class::C::@method::methodPositionalWithoutDefault::@formalParameter::p | |
| #F10 isComplete isOriginDeclaration methodNamed (nameOffset:167) (firstTokenOffset:162) (offset:167) | |
| element: <testLibrary>::@class::C::@method::methodNamed | |
| formalParameters | |
| #F11 optionalNamed hasImplicitType isOriginDeclaration p (nameOffset:180) (firstTokenOffset:180) (offset:180) | |
| element: <testLibrary>::@class::C::@method::methodNamed::@formalParameter::p | |
| initializer: expression_3 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @183 | |
| staticType: int | |
| operator: + @185 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @187 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| #F12 isComplete isOriginDeclaration methodNamedWithoutDefault (nameOffset:201) (firstTokenOffset:196) (offset:201) | |
| element: <testLibrary>::@class::C::@method::methodNamedWithoutDefault | |
| formalParameters | |
| #F13 optionalNamed hasImplicitType isOriginDeclaration p (nameOffset:228) (firstTokenOffset:228) (offset:228) | |
| element: <testLibrary>::@class::C::@method::methodNamedWithoutDefault::@formalParameter::p | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isConst isOriginDeclaration positional | |
| reference: <testLibrary>::@class::C::@constructor::positional | |
| firstFragment: #F2 | |
| formalParameters | |
| #E0 optionalPositional hasDefaultValue hasImplicitType p | |
| firstFragment: #F3 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| isConst isOriginDeclaration named | |
| reference: <testLibrary>::@class::C::@constructor::named | |
| firstFragment: #F4 | |
| formalParameters | |
| #E1 optionalNamed hasDefaultValue hasImplicitType p | |
| firstFragment: #F5 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_1 | |
| methods | |
| isOriginDeclaration methodPositional | |
| reference: <testLibrary>::@class::C::@method::methodPositional | |
| firstFragment: #F6 | |
| formalParameters | |
| #E2 optionalPositional hasDefaultValue hasImplicitType p | |
| firstFragment: #F7 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_2 | |
| returnType: void | |
| isOriginDeclaration methodPositionalWithoutDefault | |
| reference: <testLibrary>::@class::C::@method::methodPositionalWithoutDefault | |
| firstFragment: #F8 | |
| formalParameters | |
| #E3 optionalPositional hasImplicitType p | |
| firstFragment: #F9 | |
| type: dynamic | |
| returnType: void | |
| isOriginDeclaration methodNamed | |
| reference: <testLibrary>::@class::C::@method::methodNamed | |
| firstFragment: #F10 | |
| formalParameters | |
| #E4 optionalNamed hasDefaultValue hasImplicitType p | |
| firstFragment: #F11 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_3 | |
| returnType: void | |
| isOriginDeclaration methodNamedWithoutDefault | |
| reference: <testLibrary>::@class::C::@method::methodNamedWithoutDefault | |
| firstFragment: #F12 | |
| formalParameters | |
| #E5 optionalNamed hasImplicitType p | |
| firstFragment: #F13 | |
| type: dynamic | |
| returnType: void | |
| '''); | |
| } | |
| test_const_postfixExpression_increment() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = a++; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| IncrementOrDecrementExpression | |
| target: UnqualifiedNameAssignmentTarget | |
| name: a @23 | |
| read: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| write: InvalidNamedWriteResolution | |
| recoveryElement: <testLibrary>::@getter::a | |
| operator: ++ @24 | |
| operation: increment | |
| position: postfix | |
| element: dart:core::@class::num::@method::+ | |
| operatorResultType: int | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_postfixExpression_increment_invalidTarget() async { | |
| var library = await buildLibrary(r''' | |
| const a = ((0)++); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @10 | |
| expression2: IncrementOrDecrementExpression | |
| target: InvalidExpressionAssignmentTarget | |
| expression: ParenthesizedExpression | |
| leftParenthesis: ( @11 | |
| expression2: IntegerLiteral | |
| literal: 0 @12 | |
| staticType: int | |
| rightParenthesis: ) @13 | |
| staticType: int | |
| read: InvalidReadResolution | |
| write: InvalidWriteResolution | |
| operator: ++ @14 | |
| operation: increment | |
| position: postfix | |
| element: <null> | |
| operatorResultType: InvalidType | |
| staticType: InvalidType | |
| expression(v1): PostfixExpression | |
| operand: ParenthesizedExpression | |
| leftParenthesis: ( @11 | |
| expression: IntegerLiteral | |
| literal: 0 @12 | |
| staticType: int | |
| rightParenthesis: ) @13 | |
| staticType: int | |
| operator: ++ @14 | |
| readElement: <null> | |
| readType: InvalidType | |
| writeElement: <null> | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: InvalidType | |
| rightParenthesis: ) @16 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| test_const_prefixExpression_class_unaryMinus() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = -a; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| UnaryOperatorInvocation | |
| operator: - @23 | |
| operand: UnqualifiedNameExpression | |
| name: a @24 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| unaryOperator: negate | |
| element: dart:core::@class::int::@method::unary- | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_prefixExpression_extension_unaryMinus() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| extension E on Object { | |
| int operator -() => 0; | |
| } | |
| const a = const Object(); | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const b = -a; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_0 | |
| UnaryOperatorInvocation | |
| operator: - @28 | |
| operand: UnqualifiedNameExpression | |
| name: a @29 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::a | |
| invokeType: Object Function() | |
| type: Object | |
| staticType: Object | |
| unaryOperator: negate | |
| element: package:test/a.dart::@extension::E::@method::unary- | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_prefixExpression_increment() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = ++a; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| IncrementOrDecrementExpression | |
| operator: ++ @23 | |
| target: UnqualifiedNameAssignmentTarget | |
| name: a @25 | |
| read: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| write: InvalidNamedWriteResolution | |
| recoveryElement: <testLibrary>::@getter::a | |
| operation: increment | |
| position: prefix | |
| element: dart:core::@class::num::@method::+ | |
| operatorResultType: int | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_prefixExpression_increment_invalidTarget() async { | |
| var library = await buildLibrary(r''' | |
| const a = (++(0)); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| ParenthesizedExpression | |
| leftParenthesis: ( @10 | |
| expression2: IncrementOrDecrementExpression | |
| operator: ++ @11 | |
| target: InvalidExpressionAssignmentTarget | |
| expression: ParenthesizedExpression | |
| leftParenthesis: ( @13 | |
| expression2: IntegerLiteral | |
| literal: 0 @14 | |
| staticType: int | |
| rightParenthesis: ) @15 | |
| staticType: int | |
| read: InvalidReadResolution | |
| write: InvalidWriteResolution | |
| operation: increment | |
| position: prefix | |
| element: <null> | |
| operatorResultType: InvalidType | |
| staticType: InvalidType | |
| expression(v1): PrefixExpression | |
| operator: ++ @11 | |
| operand: ParenthesizedExpression | |
| leftParenthesis: ( @13 | |
| expression: IntegerLiteral | |
| literal: 0 @14 | |
| staticType: int | |
| rightParenthesis: ) @15 | |
| staticType: int | |
| readElement: <null> | |
| readType: InvalidType | |
| writeElement: <null> | |
| writeType: InvalidType | |
| element: <null> | |
| staticType: InvalidType | |
| rightParenthesis: ) @16 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::a | |
| '''); | |
| } | |
| void test_const_recordLiteral() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = (a, a: a); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| RecordLiteral | |
| leftParenthesis: ( @23 | |
| fields2 | |
| UnqualifiedNameExpression | |
| name: a @24 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| RecordLiteralNamedField | |
| name: a @27 | |
| colon: : @28 | |
| fieldExpression2: UnqualifiedNameExpression | |
| name: a @30 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| fieldExpression(v1): SimpleIdentifier | |
| token: a @30 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| fields(v1) | |
| SimpleIdentifier | |
| token: a @24 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| RecordLiteralNamedField | |
| name: a @27 | |
| colon: : @28 | |
| fieldExpression: SimpleIdentifier | |
| token: a @30 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| rightParenthesis: ) @31 | |
| staticType: (int, {int a}) | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: (int, {int a}) | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: (int, {int a}) | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| void test_const_recordLiteral_explicitConst() async { | |
| var library = await buildLibrary(r''' | |
| const a = 0; | |
| const b = const (a, a: a); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| RecordLiteral | |
| constKeyword: const @23 | |
| leftParenthesis: ( @29 | |
| fields2 | |
| UnqualifiedNameExpression | |
| name: a @30 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| RecordLiteralNamedField | |
| name: a @33 | |
| colon: : @34 | |
| fieldExpression2: UnqualifiedNameExpression | |
| name: a @36 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| fieldExpression(v1): SimpleIdentifier | |
| token: a @36 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| fields(v1) | |
| SimpleIdentifier | |
| token: a @30 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| RecordLiteralNamedField | |
| name: a @33 | |
| colon: : @34 | |
| fieldExpression: SimpleIdentifier | |
| token: a @36 | |
| element: <testLibrary>::@getter::a | |
| staticType: int | |
| rightParenthesis: ) @37 | |
| staticType: (int, {int a}) | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: (int, {int a}) | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: (int, {int a}) | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_reference_staticField() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const int F = 42; | |
| } | |
| const V = C.F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasInitializer isConst isOriginDeclaration isStatic F (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@class::C::@field::F | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 42 @33 | |
| staticType: int | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic F (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@class::C::@getter::F | |
| inducingVariable: #F2 | |
| topLevelVariables | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:46) (firstTokenOffset:46) (offset:46) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_1 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @50 | |
| element: <testLibrary>::@class::C | |
| operator: . @51 | |
| name: F @52 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::C::@getter::F | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasInitializer isConst isOriginDeclaration isStatic F | |
| reference: <testLibrary>::@class::C::@field::F | |
| firstFragment: #F2 | |
| type: int | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::F | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable isStatic F | |
| reference: <testLibrary>::@class::C::@getter::F | |
| firstFragment: #F3 | |
| returnType: int | |
| variable: <testLibrary>::@class::C::@field::F | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticField_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static const int F = 42; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = C.F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @28 | |
| element: package:test/a.dart::@class::C | |
| operator: . @29 | |
| name: F @30 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@class::C::@getter::F | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticField_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static const int F = 42; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = p.C.F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @35 | |
| element: package:test/a.dart::@class::C | |
| operator: . @36 | |
| name: F @37 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@class::C::@getter::F | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticMethod() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static int m(int a, String b) => 42; | |
| } | |
| const V = C.m; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| methods | |
| #F3 isComplete isOriginDeclaration isStatic m (nameOffset:23) (firstTokenOffset:12) (offset:23) | |
| element: <testLibrary>::@class::C::@method::m | |
| formalParameters | |
| #F4 requiredPositional isOriginDeclaration a (nameOffset:29) (firstTokenOffset:25) (offset:29) | |
| element: <testLibrary>::@class::C::@method::m::@formalParameter::a | |
| #F5 requiredPositional isOriginDeclaration b (nameOffset:39) (firstTokenOffset:32) (offset:39) | |
| element: <testLibrary>::@class::C::@method::m::@formalParameter::b | |
| topLevelVariables | |
| #F6 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:58) (firstTokenOffset:58) (offset:58) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @62 | |
| element: <testLibrary>::@class::C | |
| operator: . @63 | |
| name: m @64 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@class::C::@method::m | |
| type: int Function(int, String) | |
| staticType: int Function(int, String) | |
| inducedGetter: #F7 | |
| getters | |
| #F7 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:58) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F6 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| methods | |
| isOriginDeclaration isStatic m | |
| reference: <testLibrary>::@class::C::@method::m | |
| firstFragment: #F3 | |
| formalParameters | |
| #E0 requiredPositional a | |
| firstFragment: #F4 | |
| type: int | |
| #E1 requiredPositional b | |
| firstFragment: #F5 | |
| type: String | |
| returnType: int | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F6 | |
| type: int Function(int, String) | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F7 | |
| returnType: int Function(int, String) | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticMethod_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static int m(int a, String b) => 42; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = C.m; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @28 | |
| element: package:test/a.dart::@class::C | |
| operator: . @29 | |
| name: m @30 | |
| resolution: ExecutableTearOffResolution | |
| element: package:test/a.dart::@class::C::@method::m | |
| type: int Function(int, String) | |
| staticType: int Function(int, String) | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: int Function(int, String) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: int Function(int, String) | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticMethod_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C { | |
| static int m(int a, String b) => 42; | |
| } | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = p.C.m; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @35 | |
| element: package:test/a.dart::@class::C | |
| operator: . @36 | |
| name: m @37 | |
| resolution: ExecutableTearOffResolution | |
| element: package:test/a.dart::@class::C::@method::m | |
| type: int Function(int, String) | |
| staticType: int Function(int, String) | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: int Function(int, String) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: int Function(int, String) | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_staticMethod_ofExtension() async { | |
| var library = await buildLibrary(r''' | |
| class A {} | |
| extension E on A { | |
| static void f() {} | |
| } | |
| const x = E.f; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class A (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::A | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::A::@constructor::new | |
| typeName: A | |
| extensions | |
| #F3 extension E (nameOffset:22) (firstTokenOffset:12) (offset:22) | |
| element: <testLibrary>::@extension::E | |
| methods | |
| #F4 isComplete isOriginDeclaration isStatic f (nameOffset:45) (firstTokenOffset:33) (offset:45) | |
| element: <testLibrary>::@extension::E::@method::f | |
| topLevelVariables | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:61) (firstTokenOffset:61) (offset:61) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: E @65 | |
| element: <testLibrary>::@extension::E | |
| operator: . @66 | |
| name: f @67 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@extension::E::@method::f | |
| type: void Function() | |
| staticType: void Function() | |
| inducedGetter: #F6 | |
| getters | |
| #F6 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:61) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F5 | |
| classes | |
| isSimplyBounded class A | |
| reference: <testLibrary>::@class::A | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::A::@constructor::new | |
| firstFragment: #F2 | |
| extensions | |
| extension E | |
| reference: <testLibrary>::@extension::E | |
| firstFragment: #F3 | |
| extendedType: A | |
| onDeclaration: <testLibrary>::@class::A | |
| methods | |
| isOriginDeclaration isStatic f | |
| reference: <testLibrary>::@extension::E::@method::f | |
| firstFragment: #F4 | |
| returnType: void | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F5 | |
| type: void Function() | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F6 | |
| returnType: void Function() | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_reference_topLevelFunction() async { | |
| var library = await buildLibrary(r''' | |
| foo() {} | |
| const V = foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:15) (firstTokenOffset:15) (offset:15) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: foo @19 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::foo | |
| type: dynamic Function() | |
| staticType: dynamic Function() | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| functions | |
| #F3 hasImplicitReturnType isComplete isOriginDeclaration isStatic foo (nameOffset:0) (firstTokenOffset:0) (offset:0) | |
| element: <testLibrary>::@function::foo | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: dynamic Function() | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: dynamic Function() | |
| variable: <testLibrary>::@topLevelVariable::V | |
| functions | |
| hasImplicitReturnType isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F3 | |
| returnType: dynamic | |
| '''); | |
| } | |
| test_const_reference_topLevelFunction_generic() async { | |
| var library = await buildLibrary(r''' | |
| R foo<P, R>(P p) {} | |
| const V = foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:26) (firstTokenOffset:26) (offset:26) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: foo @30 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@function::foo | |
| type: R Function<P, R>(P) | |
| staticType: R Function<P, R>(P) | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| functions | |
| #F3 isComplete isOriginDeclaration isStatic foo (nameOffset:2) (firstTokenOffset:0) (offset:2) | |
| element: <testLibrary>::@function::foo | |
| typeParameters | |
| #F4 P (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: #E0 P | |
| #F5 R (nameOffset:9) (firstTokenOffset:9) (offset:9) | |
| element: #E1 R | |
| formalParameters | |
| #F6 requiredPositional isOriginDeclaration p (nameOffset:14) (firstTokenOffset:12) (offset:14) | |
| element: <testLibrary>::@function::foo::@formalParameter::p | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: R Function<P, R>(P) | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: R Function<P, R>(P) | |
| variable: <testLibrary>::@topLevelVariable::V | |
| functions | |
| isOriginDeclaration isStatic foo | |
| reference: <testLibrary>::@function::foo | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 P | |
| firstFragment: #F4 | |
| #E1 R | |
| firstFragment: #F5 | |
| formalParameters | |
| #E2 requiredPositional p | |
| firstFragment: #F6 | |
| type: P | |
| returnType: R | |
| '''); | |
| } | |
| test_const_reference_topLevelFunction_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| foo() {} | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const V = foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: foo @28 | |
| resolution: ExecutableTearOffResolution | |
| element: package:test/a.dart::@function::foo | |
| type: dynamic Function() | |
| staticType: dynamic Function() | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: dynamic Function() | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: dynamic Function() | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_topLevelFunction_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| foo() {} | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const V = p.foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ImportPrefixedNameExpression | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: foo @35 | |
| resolution: ExecutableTearOffResolution | |
| element: package:test/a.dart::@function::foo | |
| type: dynamic Function() | |
| staticType: dynamic Function() | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: dynamic Function() | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: dynamic Function() | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_topLevelVariable() async { | |
| var library = await buildLibrary(r''' | |
| const A = 1; | |
| const B = A + 2; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic A (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::A | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 1 @10 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic B (nameOffset:19) (firstTokenOffset:19) (offset:19) | |
| element: <testLibrary>::@topLevelVariable::B | |
| initializer: expression_1 | |
| BinaryOperatorInvocation | |
| leftOperand: UnqualifiedNameExpression | |
| name: A @23 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::A | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| operator: + @25 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @27 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic A (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::A | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic B (nameOffset:<null>) (firstTokenOffset:<null>) (offset:19) | |
| element: <testLibrary>::@getter::B | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer A | |
| reference: <testLibrary>::@topLevelVariable::A | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::A | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer B | |
| reference: <testLibrary>::@topLevelVariable::B | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::B | |
| getters | |
| isOriginVariable isStatic A | |
| reference: <testLibrary>::@getter::A | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::A | |
| isOriginVariable isStatic B | |
| reference: <testLibrary>::@getter::B | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::B | |
| '''); | |
| } | |
| test_const_reference_topLevelVariable_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| const A = 1; | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const B = A + 2; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic B (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::B | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: UnqualifiedNameExpression | |
| name: A @28 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::A | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| operator: + @30 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @32 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic B (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::B | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer B | |
| reference: <testLibrary>::@topLevelVariable::B | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::B | |
| getters | |
| isOriginVariable isStatic B | |
| reference: <testLibrary>::@getter::B | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::B | |
| '''); | |
| } | |
| test_const_reference_topLevelVariable_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| const A = 1; | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const B = p.A + 2; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic B (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::B | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: ImportPrefixedNameExpression | |
| importPrefix: ImportPrefixReference | |
| name: p @33 | |
| period: . @34 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: A @35 | |
| resolution: GetterInvocationResolution | |
| element: package:test/a.dart::@getter::A | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| operator: + @37 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @39 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic B (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::B | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer B | |
| reference: <testLibrary>::@topLevelVariable::B | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::B | |
| getters | |
| isOriginVariable isStatic B | |
| reference: <testLibrary>::@getter::B | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::B | |
| '''); | |
| } | |
| test_const_reference_type() async { | |
| var library = await buildLibrary(r''' | |
| class C {} | |
| class D<T> {} | |
| enum E { a, b, c } | |
| typedef F(int a, String b); | |
| const vDynamic = dynamic; | |
| const vNull = Null; | |
| const vObject = Object; | |
| const vClass = C; | |
| const vGenericClass = D; | |
| const vEnum = E; | |
| const vFunctionTypeAlias = F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| #F3 class D (nameOffset:18) (firstTokenOffset:12) (offset:18) | |
| element: <testLibrary>::@class::D | |
| typeParameters | |
| #F4 T (nameOffset:20) (firstTokenOffset:20) (offset:20) | |
| element: #E0 T | |
| constructors | |
| #F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@class::D::@constructor::new | |
| typeName: D | |
| enums | |
| #F6 enum E (nameOffset:32) (firstTokenOffset:27) (offset:32) | |
| element: <testLibrary>::@enum::E | |
| fields | |
| #F7 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic a (nameOffset:36) (firstTokenOffset:36) (offset:36) | |
| element: <testLibrary>::@enum::E::@field::a | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F8 | |
| #F9 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic b (nameOffset:39) (firstTokenOffset:39) (offset:39) | |
| element: <testLibrary>::@enum::E::@field::b | |
| initializer: expression_1 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F10 | |
| #F11 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic c (nameOffset:42) (firstTokenOffset:42) (offset:42) | |
| element: <testLibrary>::@enum::E::@field::c | |
| initializer: expression_2 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F12 | |
| #F13 isConst isOriginEnumValues isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@enum::E::@field::values | |
| initializer: expression_3 | |
| ListLiteral | |
| leftBracket: [ @0 | |
| elements2 | |
| UnqualifiedNameExpression | |
| name: a @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::a | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| UnqualifiedNameExpression | |
| name: b @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::b | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| UnqualifiedNameExpression | |
| name: c @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::c | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| elements(v1) | |
| SimpleIdentifier | |
| token: a @-1 | |
| element: <testLibrary>::@enum::E::@getter::a | |
| staticType: E | |
| SimpleIdentifier | |
| token: b @-1 | |
| element: <testLibrary>::@enum::E::@getter::b | |
| staticType: E | |
| SimpleIdentifier | |
| token: c @-1 | |
| element: <testLibrary>::@enum::E::@getter::c | |
| staticType: E | |
| rightBracket: ] @0 | |
| staticType: List<E> | |
| inducedGetter: #F14 | |
| constructors | |
| #F15 isConst isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| typeName: E | |
| getters | |
| #F8 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36) | |
| element: <testLibrary>::@enum::E::@getter::a | |
| inducingVariable: #F7 | |
| #F10 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:39) | |
| element: <testLibrary>::@enum::E::@getter::b | |
| inducingVariable: #F9 | |
| #F12 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42) | |
| element: <testLibrary>::@enum::E::@getter::c | |
| inducingVariable: #F11 | |
| #F14 isComplete isOriginVariable isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@enum::E::@getter::values | |
| inducingVariable: #F13 | |
| typeAliases | |
| #F16 F (nameOffset:55) (firstTokenOffset:47) (offset:55) | |
| element: <testLibrary>::@typeAlias::F | |
| topLevelVariables | |
| #F17 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDynamic (nameOffset:81) (firstTokenOffset:81) (offset:81) | |
| element: <testLibrary>::@topLevelVariable::vDynamic | |
| initializer: expression_4 | |
| TypeLiteral | |
| type: NamedType | |
| name: dynamic @92 | |
| element: dynamic | |
| type: dynamic | |
| staticType: Type | |
| inducedGetter: #F18 | |
| #F19 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNull (nameOffset:107) (firstTokenOffset:107) (offset:107) | |
| element: <testLibrary>::@topLevelVariable::vNull | |
| initializer: expression_5 | |
| TypeLiteral | |
| type: NamedType | |
| name: Null @115 | |
| element: dart:core::@class::Null | |
| type: Null | |
| staticType: Type | |
| inducedGetter: #F20 | |
| #F21 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vObject (nameOffset:127) (firstTokenOffset:127) (offset:127) | |
| element: <testLibrary>::@topLevelVariable::vObject | |
| initializer: expression_6 | |
| TypeLiteral | |
| type: NamedType | |
| name: Object @137 | |
| element: dart:core::@class::Object | |
| type: Object | |
| staticType: Type | |
| inducedGetter: #F22 | |
| #F23 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vClass (nameOffset:151) (firstTokenOffset:151) (offset:151) | |
| element: <testLibrary>::@topLevelVariable::vClass | |
| initializer: expression_7 | |
| TypeLiteral | |
| type: NamedType | |
| name: C @160 | |
| element: <testLibrary>::@class::C | |
| type: C | |
| staticType: Type | |
| inducedGetter: #F24 | |
| #F25 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vGenericClass (nameOffset:169) (firstTokenOffset:169) (offset:169) | |
| element: <testLibrary>::@topLevelVariable::vGenericClass | |
| initializer: expression_8 | |
| TypeLiteral | |
| type: NamedType | |
| name: D @185 | |
| element: <testLibrary>::@class::D | |
| type: D<dynamic> | |
| staticType: Type | |
| inducedGetter: #F26 | |
| #F27 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vEnum (nameOffset:194) (firstTokenOffset:194) (offset:194) | |
| element: <testLibrary>::@topLevelVariable::vEnum | |
| initializer: expression_9 | |
| TypeLiteral | |
| type: NamedType | |
| name: E @202 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| staticType: Type | |
| inducedGetter: #F28 | |
| #F29 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vFunctionTypeAlias (nameOffset:211) (firstTokenOffset:211) (offset:211) | |
| element: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| initializer: expression_10 | |
| TypeLiteral | |
| type: NamedType | |
| name: F @232 | |
| element: <testLibrary>::@typeAlias::F | |
| type: dynamic Function(int, String) | |
| alias: <testLibrary>::@typeAlias::F | |
| staticType: Type | |
| inducedGetter: #F30 | |
| getters | |
| #F18 isComplete isOriginVariable isStatic vDynamic (nameOffset:<null>) (firstTokenOffset:<null>) (offset:81) | |
| element: <testLibrary>::@getter::vDynamic | |
| inducingVariable: #F17 | |
| #F20 isComplete isOriginVariable isStatic vNull (nameOffset:<null>) (firstTokenOffset:<null>) (offset:107) | |
| element: <testLibrary>::@getter::vNull | |
| inducingVariable: #F19 | |
| #F22 isComplete isOriginVariable isStatic vObject (nameOffset:<null>) (firstTokenOffset:<null>) (offset:127) | |
| element: <testLibrary>::@getter::vObject | |
| inducingVariable: #F21 | |
| #F24 isComplete isOriginVariable isStatic vClass (nameOffset:<null>) (firstTokenOffset:<null>) (offset:151) | |
| element: <testLibrary>::@getter::vClass | |
| inducingVariable: #F23 | |
| #F26 isComplete isOriginVariable isStatic vGenericClass (nameOffset:<null>) (firstTokenOffset:<null>) (offset:169) | |
| element: <testLibrary>::@getter::vGenericClass | |
| inducingVariable: #F25 | |
| #F28 isComplete isOriginVariable isStatic vEnum (nameOffset:<null>) (firstTokenOffset:<null>) (offset:194) | |
| element: <testLibrary>::@getter::vEnum | |
| inducingVariable: #F27 | |
| #F30 isComplete isOriginVariable isStatic vFunctionTypeAlias (nameOffset:<null>) (firstTokenOffset:<null>) (offset:211) | |
| element: <testLibrary>::@getter::vFunctionTypeAlias | |
| inducingVariable: #F29 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| isSimplyBounded class D | |
| reference: <testLibrary>::@class::D | |
| firstFragment: #F3 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F4 | |
| constructors | |
| hasEnclosingTypeParameterReference isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::D::@constructor::new | |
| firstFragment: #F5 | |
| enums | |
| isSimplyBounded enum E | |
| reference: <testLibrary>::@enum::E | |
| firstFragment: #F6 | |
| supertype: Enum | |
| fields | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@enum::E::@field::a | |
| firstFragment: #F7 | |
| type: E | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_0 | |
| getter: <testLibrary>::@enum::E::@getter::a | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@enum::E::@field::b | |
| firstFragment: #F9 | |
| type: E | |
| constantInitializer | |
| fragment: #F9 | |
| expression: expression_1 | |
| getter: <testLibrary>::@enum::E::@getter::b | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@enum::E::@field::c | |
| firstFragment: #F11 | |
| type: E | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_2 | |
| getter: <testLibrary>::@enum::E::@getter::c | |
| isConst isOriginEnumValues isStatic values | |
| reference: <testLibrary>::@enum::E::@field::values | |
| firstFragment: #F13 | |
| type: List<E> | |
| constantInitializer | |
| fragment: #F13 | |
| expression: expression_3 | |
| getter: <testLibrary>::@enum::E::@getter::values | |
| constructors | |
| isConst isOriginImplicitDefault new | |
| reference: <testLibrary>::@enum::E::@constructor::new | |
| firstFragment: #F15 | |
| superConstructor: dart:core::@class::Enum::@constructor::new | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@enum::E::@getter::a | |
| firstFragment: #F8 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@enum::E::@getter::b | |
| firstFragment: #F10 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::b | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@enum::E::@getter::c | |
| firstFragment: #F12 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::c | |
| isOriginVariable isStatic values | |
| reference: <testLibrary>::@enum::E::@getter::values | |
| firstFragment: #F14 | |
| returnType: List<E> | |
| variable: <testLibrary>::@enum::E::@field::values | |
| typeAliases | |
| isSimplyBounded F | |
| reference: <testLibrary>::@typeAlias::F | |
| firstFragment: #F16 | |
| aliasedType: dynamic Function(int, String) | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDynamic | |
| reference: <testLibrary>::@topLevelVariable::vDynamic | |
| firstFragment: #F17 | |
| type: Type | |
| constantInitializer | |
| fragment: #F17 | |
| expression: expression_4 | |
| getter: <testLibrary>::@getter::vDynamic | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNull | |
| reference: <testLibrary>::@topLevelVariable::vNull | |
| firstFragment: #F19 | |
| type: Type | |
| constantInitializer | |
| fragment: #F19 | |
| expression: expression_5 | |
| getter: <testLibrary>::@getter::vNull | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vObject | |
| reference: <testLibrary>::@topLevelVariable::vObject | |
| firstFragment: #F21 | |
| type: Type | |
| constantInitializer | |
| fragment: #F21 | |
| expression: expression_6 | |
| getter: <testLibrary>::@getter::vObject | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vClass | |
| reference: <testLibrary>::@topLevelVariable::vClass | |
| firstFragment: #F23 | |
| type: Type | |
| constantInitializer | |
| fragment: #F23 | |
| expression: expression_7 | |
| getter: <testLibrary>::@getter::vClass | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vGenericClass | |
| reference: <testLibrary>::@topLevelVariable::vGenericClass | |
| firstFragment: #F25 | |
| type: Type | |
| constantInitializer | |
| fragment: #F25 | |
| expression: expression_8 | |
| getter: <testLibrary>::@getter::vGenericClass | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vEnum | |
| reference: <testLibrary>::@topLevelVariable::vEnum | |
| firstFragment: #F27 | |
| type: Type | |
| constantInitializer | |
| fragment: #F27 | |
| expression: expression_9 | |
| getter: <testLibrary>::@getter::vEnum | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vFunctionTypeAlias | |
| reference: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| firstFragment: #F29 | |
| type: Type | |
| constantInitializer | |
| fragment: #F29 | |
| expression: expression_10 | |
| getter: <testLibrary>::@getter::vFunctionTypeAlias | |
| getters | |
| isOriginVariable isStatic vDynamic | |
| reference: <testLibrary>::@getter::vDynamic | |
| firstFragment: #F18 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vDynamic | |
| isOriginVariable isStatic vNull | |
| reference: <testLibrary>::@getter::vNull | |
| firstFragment: #F20 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vNull | |
| isOriginVariable isStatic vObject | |
| reference: <testLibrary>::@getter::vObject | |
| firstFragment: #F22 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vObject | |
| isOriginVariable isStatic vClass | |
| reference: <testLibrary>::@getter::vClass | |
| firstFragment: #F24 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vClass | |
| isOriginVariable isStatic vGenericClass | |
| reference: <testLibrary>::@getter::vGenericClass | |
| firstFragment: #F26 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vGenericClass | |
| isOriginVariable isStatic vEnum | |
| reference: <testLibrary>::@getter::vEnum | |
| firstFragment: #F28 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vEnum | |
| isOriginVariable isStatic vFunctionTypeAlias | |
| reference: <testLibrary>::@getter::vFunctionTypeAlias | |
| firstFragment: #F30 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| '''); | |
| } | |
| test_const_reference_type_functionType() async { | |
| var library = await buildLibrary(r''' | |
| typedef F(); | |
| class C { | |
| final f = <F>[]; | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:20) (firstTokenOffset:14) (offset:20) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType hasInitializer isFinal isOriginDeclaration f (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@class::C::@field::f | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@class::C::@getter::f | |
| inducingVariable: #F2 | |
| typeAliases | |
| #F5 F (nameOffset:8) (firstTokenOffset:0) (offset:8) | |
| element: <testLibrary>::@typeAlias::F | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer f | |
| reference: <testLibrary>::@class::C::@field::f | |
| firstFragment: #F2 | |
| type: List<dynamic Function()> | |
| getter: <testLibrary>::@class::C::@getter::f | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable f | |
| reference: <testLibrary>::@class::C::@getter::f | |
| firstFragment: #F3 | |
| returnType: List<dynamic Function()> | |
| variable: <testLibrary>::@class::C::@field::f | |
| typeAliases | |
| isSimplyBounded F | |
| reference: <testLibrary>::@typeAlias::F | |
| firstFragment: #F5 | |
| aliasedType: dynamic Function() | |
| '''); | |
| } | |
| test_const_reference_type_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C {} | |
| enum E {a, b, c} | |
| typedef F(int a, String b); | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const vClass = C; | |
| const vEnum = E; | |
| const vFunctionTypeAlias = F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vClass (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::vClass | |
| initializer: expression_0 | |
| TypeLiteral | |
| type: NamedType | |
| name: C @33 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| staticType: Type | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vEnum (nameOffset:42) (firstTokenOffset:42) (offset:42) | |
| element: <testLibrary>::@topLevelVariable::vEnum | |
| initializer: expression_1 | |
| TypeLiteral | |
| type: NamedType | |
| name: E @50 | |
| element: package:test/a.dart::@enum::E | |
| type: E | |
| staticType: Type | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vFunctionTypeAlias (nameOffset:59) (firstTokenOffset:59) (offset:59) | |
| element: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| initializer: expression_2 | |
| TypeLiteral | |
| type: NamedType | |
| name: F @80 | |
| element: package:test/a.dart::@typeAlias::F | |
| type: dynamic Function(int, String) | |
| alias: package:test/a.dart::@typeAlias::F | |
| staticType: Type | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vClass (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::vClass | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vEnum (nameOffset:<null>) (firstTokenOffset:<null>) (offset:42) | |
| element: <testLibrary>::@getter::vEnum | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vFunctionTypeAlias (nameOffset:<null>) (firstTokenOffset:<null>) (offset:59) | |
| element: <testLibrary>::@getter::vFunctionTypeAlias | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vClass | |
| reference: <testLibrary>::@topLevelVariable::vClass | |
| firstFragment: #F1 | |
| type: Type | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vClass | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vEnum | |
| reference: <testLibrary>::@topLevelVariable::vEnum | |
| firstFragment: #F3 | |
| type: Type | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vEnum | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vFunctionTypeAlias | |
| reference: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| firstFragment: #F5 | |
| type: Type | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vFunctionTypeAlias | |
| getters | |
| isOriginVariable isStatic vClass | |
| reference: <testLibrary>::@getter::vClass | |
| firstFragment: #F2 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vClass | |
| isOriginVariable isStatic vEnum | |
| reference: <testLibrary>::@getter::vEnum | |
| firstFragment: #F4 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vEnum | |
| isOriginVariable isStatic vFunctionTypeAlias | |
| reference: <testLibrary>::@getter::vFunctionTypeAlias | |
| firstFragment: #F6 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| '''); | |
| } | |
| test_const_reference_type_imported_withPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C {} | |
| enum E {a, b, c} | |
| typedef F(int a, String b); | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const vClass = p.C; | |
| const vEnum = p.E; | |
| const vFunctionTypeAlias = p.F; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vClass (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::vClass | |
| initializer: expression_0 | |
| TypeLiteral | |
| type: NamedType | |
| importPrefix: ImportPrefixReference | |
| name: p @38 | |
| period: . @39 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @40 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| staticType: Type | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vEnum (nameOffset:49) (firstTokenOffset:49) (offset:49) | |
| element: <testLibrary>::@topLevelVariable::vEnum | |
| initializer: expression_1 | |
| TypeLiteral | |
| type: NamedType | |
| importPrefix: ImportPrefixReference | |
| name: p @57 | |
| period: . @58 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: E @59 | |
| element: package:test/a.dart::@enum::E | |
| type: E | |
| staticType: Type | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vFunctionTypeAlias (nameOffset:68) (firstTokenOffset:68) (offset:68) | |
| element: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| initializer: expression_2 | |
| TypeLiteral | |
| type: NamedType | |
| importPrefix: ImportPrefixReference | |
| name: p @89 | |
| period: . @90 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: F @91 | |
| element: package:test/a.dart::@typeAlias::F | |
| type: dynamic Function(int, String) | |
| alias: package:test/a.dart::@typeAlias::F | |
| staticType: Type | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vClass (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::vClass | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vEnum (nameOffset:<null>) (firstTokenOffset:<null>) (offset:49) | |
| element: <testLibrary>::@getter::vEnum | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vFunctionTypeAlias (nameOffset:<null>) (firstTokenOffset:<null>) (offset:68) | |
| element: <testLibrary>::@getter::vFunctionTypeAlias | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vClass | |
| reference: <testLibrary>::@topLevelVariable::vClass | |
| firstFragment: #F1 | |
| type: Type | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vClass | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vEnum | |
| reference: <testLibrary>::@topLevelVariable::vEnum | |
| firstFragment: #F3 | |
| type: Type | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vEnum | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vFunctionTypeAlias | |
| reference: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| firstFragment: #F5 | |
| type: Type | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vFunctionTypeAlias | |
| getters | |
| isOriginVariable isStatic vClass | |
| reference: <testLibrary>::@getter::vClass | |
| firstFragment: #F2 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vClass | |
| isOriginVariable isStatic vEnum | |
| reference: <testLibrary>::@getter::vEnum | |
| firstFragment: #F4 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vEnum | |
| isOriginVariable isStatic vFunctionTypeAlias | |
| reference: <testLibrary>::@getter::vFunctionTypeAlias | |
| firstFragment: #F6 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::vFunctionTypeAlias | |
| '''); | |
| } | |
| test_const_reference_type_typeParameter() async { | |
| var library = await buildLibrary(r''' | |
| class C<T> { | |
| final f = <T>[]; | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| typeParameters | |
| #F2 T (nameOffset:8) (firstTokenOffset:8) (offset:8) | |
| element: #E0 T | |
| fields | |
| #F3 hasImplicitType hasInitializer isFinal isOriginDeclaration f (nameOffset:21) (firstTokenOffset:21) (offset:21) | |
| element: <testLibrary>::@class::C::@field::f | |
| inducedGetter: #F4 | |
| constructors | |
| #F5 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F4 isComplete isOriginVariable f (nameOffset:<null>) (firstTokenOffset:<null>) (offset:21) | |
| element: <testLibrary>::@class::C::@getter::f | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| typeParameters | |
| #E0 T | |
| firstFragment: #F2 | |
| fields | |
| hasEnclosingTypeParameterReference hasImplicitType hasInitializer isFinal isOriginDeclaration isTypeInferredFromInitializer f | |
| reference: <testLibrary>::@class::C::@field::f | |
| firstFragment: #F3 | |
| type: List<T> | |
| getter: <testLibrary>::@class::C::@getter::f | |
| constructors | |
| hasEnclosingTypeParameterReference isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F5 | |
| getters | |
| hasEnclosingTypeParameterReference isOriginVariable f | |
| reference: <testLibrary>::@class::C::@getter::f | |
| firstFragment: #F4 | |
| returnType: List<T> | |
| variable: <testLibrary>::@class::C::@field::f | |
| '''); | |
| } | |
| test_const_reference_unresolved_prefix0() async { | |
| var library = await buildLibrary(r''' | |
| const V = foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: foo @10 | |
| resolution: InvalidNamedReadResolution | |
| recoveryElement: <null> | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_unresolved_prefix1() async { | |
| var library = await buildLibrary(r''' | |
| class C {} | |
| const V = C.foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| constructors | |
| #F2 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| topLevelVariables | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:18) (firstTokenOffset:18) (offset:18) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| name: C @22 | |
| element: <testLibrary>::@class::C | |
| operator: . @23 | |
| name: foo @24 | |
| resolution: InvalidNamedReadResolution | |
| recoveryElement: <null> | |
| staticType: InvalidType | |
| inducedGetter: #F4 | |
| getters | |
| #F4 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:18) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F3 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F2 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F3 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F4 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_reference_unresolved_prefix2() async { | |
| newFile('$testPackageLibPath/foo.dart', r''' | |
| class C {} | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'foo.dart' as p; | |
| const V = p.C.foo; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/foo.dart as p (nameOffset:21) (firstTokenOffset:<null>) (offset:21) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @21 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic V (nameOffset:31) (firstTokenOffset:31) (offset:31) | |
| element: <testLibrary>::@topLevelVariable::V | |
| initializer: expression_0 | |
| ReceiverPropertyExtraction | |
| receiver: StaticQualifier | |
| importPrefix: ImportPrefixReference | |
| name: p @35 | |
| period: . @36 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @37 | |
| element: package:test/foo.dart::@class::C | |
| operator: . @38 | |
| name: foo @39 | |
| resolution: InvalidNamedReadResolution | |
| recoveryElement: <null> | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic V (nameOffset:<null>) (firstTokenOffset:<null>) (offset:31) | |
| element: <testLibrary>::@getter::V | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer V | |
| reference: <testLibrary>::@topLevelVariable::V | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::V | |
| getters | |
| isOriginVariable isStatic V | |
| reference: <testLibrary>::@getter::V | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::V | |
| '''); | |
| } | |
| test_const_set_if() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>{if (true) 1}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: { @28 | |
| elements2 | |
| IfElement | |
| ifKeyword: if @29 | |
| leftParenthesis: ( @32 | |
| expression2: BooleanLiteral | |
| literal: true @33 | |
| staticType: bool | |
| rightParenthesis: ) @37 | |
| thenElement2: IntegerLiteral | |
| literal: 1 @39 | |
| staticType: int | |
| rightBracket: } @40 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_set_inferredType() async { | |
| // The summary needs to contain enough information so that when the constant | |
| // is resynthesized, the constant value can get the type that was computed | |
| // by type inference. | |
| var library = await buildLibrary(r''' | |
| const Object x = const {1}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| leftBracket: { @23 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @24 | |
| staticType: int | |
| rightBracket: } @25 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_set_spread() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>{ | |
| ...<int>{1}, | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: { @28 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ... @32 | |
| expression2: SetOrMapLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @35 | |
| arguments | |
| NamedType | |
| name: int @36 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @39 | |
| leftBracket: { @40 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @41 | |
| staticType: int | |
| rightBracket: } @42 | |
| isMap: false | |
| staticType: Set<int> | |
| rightBracket: } @45 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_set_spread_null_aware() async { | |
| var library = await buildLibrary(r''' | |
| const Object x = const <int>{ | |
| ...?<int>{1}, | |
| }; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic x (nameOffset:13) (firstTokenOffset:13) (offset:13) | |
| element: <testLibrary>::@topLevelVariable::x | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @17 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @23 | |
| arguments | |
| NamedType | |
| name: int @24 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @27 | |
| leftBracket: { @28 | |
| elements2 | |
| SpreadElement | |
| spreadOperator: ...? @32 | |
| expression2: SetOrMapLiteral | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @36 | |
| arguments | |
| NamedType | |
| name: int @37 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @40 | |
| leftBracket: { @41 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @42 | |
| staticType: int | |
| rightBracket: } @43 | |
| isMap: false | |
| staticType: Set<int> | |
| rightBracket: } @46 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic x (nameOffset:<null>) (firstTokenOffset:<null>) (offset:13) | |
| element: <testLibrary>::@getter::x | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic x | |
| reference: <testLibrary>::@topLevelVariable::x | |
| firstFragment: #F1 | |
| type: Object | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::x | |
| getters | |
| isOriginVariable isStatic x | |
| reference: <testLibrary>::@getter::x | |
| firstFragment: #F2 | |
| returnType: Object | |
| variable: <testLibrary>::@topLevelVariable::x | |
| '''); | |
| } | |
| test_const_topLevel_binary() async { | |
| var library = await buildLibrary(r''' | |
| const vEqual = 1 == 2; | |
| const vAnd = true && false; | |
| const vOr = false || true; | |
| const vBitXor = 1 ^ 2; | |
| const vBitAnd = 1 & 2; | |
| const vBitOr = 1 | 2; | |
| const vBitShiftLeft = 1 << 2; | |
| const vBitShiftRight = 1 >> 2; | |
| const vAdd = 1 + 2; | |
| const vSubtract = 1 - 2; | |
| const vMiltiply = 1 * 2; | |
| const vDivide = 1 / 2; | |
| const vFloorDivide = 1 ~/ 2; | |
| const vModulo = 1 % 2; | |
| const vGreater = 1 > 2; | |
| const vGreaterEqual = 1 >= 2; | |
| const vLess = 1 < 2; | |
| const vLessEqual = 1 <= 2; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vEqual (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vEqual | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @15 | |
| staticType: int | |
| operator: == @17 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @20 | |
| staticType: int | |
| binaryOperator: equal | |
| element: dart:core::@class::num::@method::== | |
| staticType: bool | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vAnd (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::vAnd | |
| initializer: expression_1 | |
| LogicalAnd | |
| leftOperand: BooleanLiteral | |
| literal: true @36 | |
| staticType: bool | |
| operator: && @41 | |
| rightOperand: BooleanLiteral | |
| literal: false @44 | |
| staticType: bool | |
| staticType: bool | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vOr (nameOffset:57) (firstTokenOffset:57) (offset:57) | |
| element: <testLibrary>::@topLevelVariable::vOr | |
| initializer: expression_2 | |
| LogicalOr | |
| leftOperand: BooleanLiteral | |
| literal: false @63 | |
| staticType: bool | |
| operator: || @69 | |
| rightOperand: BooleanLiteral | |
| literal: true @72 | |
| staticType: bool | |
| staticType: bool | |
| inducedGetter: #F6 | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBitXor (nameOffset:84) (firstTokenOffset:84) (offset:84) | |
| element: <testLibrary>::@topLevelVariable::vBitXor | |
| initializer: expression_3 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @94 | |
| staticType: int | |
| operator: ^ @96 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @98 | |
| staticType: int | |
| binaryOperator: bitwiseXor | |
| element: dart:core::@class::int::@method::^ | |
| staticType: int | |
| inducedGetter: #F8 | |
| #F9 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBitAnd (nameOffset:107) (firstTokenOffset:107) (offset:107) | |
| element: <testLibrary>::@topLevelVariable::vBitAnd | |
| initializer: expression_4 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @117 | |
| staticType: int | |
| operator: & @119 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @121 | |
| staticType: int | |
| binaryOperator: bitwiseAnd | |
| element: dart:core::@class::int::@method::& | |
| staticType: int | |
| inducedGetter: #F10 | |
| #F11 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBitOr (nameOffset:130) (firstTokenOffset:130) (offset:130) | |
| element: <testLibrary>::@topLevelVariable::vBitOr | |
| initializer: expression_5 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @139 | |
| staticType: int | |
| operator: | @141 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @143 | |
| staticType: int | |
| binaryOperator: bitwiseOr | |
| element: dart:core::@class::int::@method::| | |
| staticType: int | |
| inducedGetter: #F12 | |
| #F13 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBitShiftLeft (nameOffset:152) (firstTokenOffset:152) (offset:152) | |
| element: <testLibrary>::@topLevelVariable::vBitShiftLeft | |
| initializer: expression_6 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @168 | |
| staticType: int | |
| operator: << @170 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @173 | |
| staticType: int | |
| binaryOperator: shiftLeft | |
| element: dart:core::@class::int::@method::<< | |
| staticType: int | |
| inducedGetter: #F14 | |
| #F15 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBitShiftRight (nameOffset:182) (firstTokenOffset:182) (offset:182) | |
| element: <testLibrary>::@topLevelVariable::vBitShiftRight | |
| initializer: expression_7 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @199 | |
| staticType: int | |
| operator: >> @201 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @204 | |
| staticType: int | |
| binaryOperator: shiftRight | |
| element: dart:core::@class::int::@method::>> | |
| staticType: int | |
| inducedGetter: #F16 | |
| #F17 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vAdd (nameOffset:213) (firstTokenOffset:213) (offset:213) | |
| element: <testLibrary>::@topLevelVariable::vAdd | |
| initializer: expression_8 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @220 | |
| staticType: int | |
| operator: + @222 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @224 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| inducedGetter: #F18 | |
| #F19 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vSubtract (nameOffset:233) (firstTokenOffset:233) (offset:233) | |
| element: <testLibrary>::@topLevelVariable::vSubtract | |
| initializer: expression_9 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @245 | |
| staticType: int | |
| operator: - @247 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @249 | |
| staticType: int | |
| binaryOperator: subtract | |
| element: dart:core::@class::num::@method::- | |
| staticType: int | |
| inducedGetter: #F20 | |
| #F21 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vMiltiply (nameOffset:258) (firstTokenOffset:258) (offset:258) | |
| element: <testLibrary>::@topLevelVariable::vMiltiply | |
| initializer: expression_10 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @270 | |
| staticType: int | |
| operator: * @272 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @274 | |
| staticType: int | |
| binaryOperator: multiply | |
| element: dart:core::@class::num::@method::* | |
| staticType: int | |
| inducedGetter: #F22 | |
| #F23 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDivide (nameOffset:283) (firstTokenOffset:283) (offset:283) | |
| element: <testLibrary>::@topLevelVariable::vDivide | |
| initializer: expression_11 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @293 | |
| staticType: int | |
| operator: / @295 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @297 | |
| staticType: int | |
| binaryOperator: divide | |
| element: dart:core::@class::num::@method::/ | |
| staticType: double | |
| inducedGetter: #F24 | |
| #F25 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vFloorDivide (nameOffset:306) (firstTokenOffset:306) (offset:306) | |
| element: <testLibrary>::@topLevelVariable::vFloorDivide | |
| initializer: expression_12 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @321 | |
| staticType: int | |
| operator: ~/ @323 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @326 | |
| staticType: int | |
| binaryOperator: truncatingDivide | |
| element: dart:core::@class::num::@method::~/ | |
| staticType: int | |
| inducedGetter: #F26 | |
| #F27 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vModulo (nameOffset:335) (firstTokenOffset:335) (offset:335) | |
| element: <testLibrary>::@topLevelVariable::vModulo | |
| initializer: expression_13 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @345 | |
| staticType: int | |
| operator: % @347 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @349 | |
| staticType: int | |
| binaryOperator: modulo | |
| element: dart:core::@class::num::@method::% | |
| staticType: int | |
| inducedGetter: #F28 | |
| #F29 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vGreater (nameOffset:358) (firstTokenOffset:358) (offset:358) | |
| element: <testLibrary>::@topLevelVariable::vGreater | |
| initializer: expression_14 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @369 | |
| staticType: int | |
| operator: > @371 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @373 | |
| staticType: int | |
| binaryOperator: greaterThan | |
| element: dart:core::@class::num::@method::> | |
| staticType: bool | |
| inducedGetter: #F30 | |
| #F31 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vGreaterEqual (nameOffset:382) (firstTokenOffset:382) (offset:382) | |
| element: <testLibrary>::@topLevelVariable::vGreaterEqual | |
| initializer: expression_15 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @398 | |
| staticType: int | |
| operator: >= @400 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @403 | |
| staticType: int | |
| binaryOperator: greaterThanOrEqual | |
| element: dart:core::@class::num::@method::>= | |
| staticType: bool | |
| inducedGetter: #F32 | |
| #F33 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vLess (nameOffset:412) (firstTokenOffset:412) (offset:412) | |
| element: <testLibrary>::@topLevelVariable::vLess | |
| initializer: expression_16 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @420 | |
| staticType: int | |
| operator: < @422 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @424 | |
| staticType: int | |
| binaryOperator: lessThan | |
| element: dart:core::@class::num::@method::< | |
| staticType: bool | |
| inducedGetter: #F34 | |
| #F35 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vLessEqual (nameOffset:433) (firstTokenOffset:433) (offset:433) | |
| element: <testLibrary>::@topLevelVariable::vLessEqual | |
| initializer: expression_17 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @446 | |
| staticType: int | |
| operator: <= @448 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @451 | |
| staticType: int | |
| binaryOperator: lessThanOrEqual | |
| element: dart:core::@class::num::@method::<= | |
| staticType: bool | |
| inducedGetter: #F36 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vEqual (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vEqual | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vAnd (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::vAnd | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vOr (nameOffset:<null>) (firstTokenOffset:<null>) (offset:57) | |
| element: <testLibrary>::@getter::vOr | |
| inducingVariable: #F5 | |
| #F8 isComplete isOriginVariable isStatic vBitXor (nameOffset:<null>) (firstTokenOffset:<null>) (offset:84) | |
| element: <testLibrary>::@getter::vBitXor | |
| inducingVariable: #F7 | |
| #F10 isComplete isOriginVariable isStatic vBitAnd (nameOffset:<null>) (firstTokenOffset:<null>) (offset:107) | |
| element: <testLibrary>::@getter::vBitAnd | |
| inducingVariable: #F9 | |
| #F12 isComplete isOriginVariable isStatic vBitOr (nameOffset:<null>) (firstTokenOffset:<null>) (offset:130) | |
| element: <testLibrary>::@getter::vBitOr | |
| inducingVariable: #F11 | |
| #F14 isComplete isOriginVariable isStatic vBitShiftLeft (nameOffset:<null>) (firstTokenOffset:<null>) (offset:152) | |
| element: <testLibrary>::@getter::vBitShiftLeft | |
| inducingVariable: #F13 | |
| #F16 isComplete isOriginVariable isStatic vBitShiftRight (nameOffset:<null>) (firstTokenOffset:<null>) (offset:182) | |
| element: <testLibrary>::@getter::vBitShiftRight | |
| inducingVariable: #F15 | |
| #F18 isComplete isOriginVariable isStatic vAdd (nameOffset:<null>) (firstTokenOffset:<null>) (offset:213) | |
| element: <testLibrary>::@getter::vAdd | |
| inducingVariable: #F17 | |
| #F20 isComplete isOriginVariable isStatic vSubtract (nameOffset:<null>) (firstTokenOffset:<null>) (offset:233) | |
| element: <testLibrary>::@getter::vSubtract | |
| inducingVariable: #F19 | |
| #F22 isComplete isOriginVariable isStatic vMiltiply (nameOffset:<null>) (firstTokenOffset:<null>) (offset:258) | |
| element: <testLibrary>::@getter::vMiltiply | |
| inducingVariable: #F21 | |
| #F24 isComplete isOriginVariable isStatic vDivide (nameOffset:<null>) (firstTokenOffset:<null>) (offset:283) | |
| element: <testLibrary>::@getter::vDivide | |
| inducingVariable: #F23 | |
| #F26 isComplete isOriginVariable isStatic vFloorDivide (nameOffset:<null>) (firstTokenOffset:<null>) (offset:306) | |
| element: <testLibrary>::@getter::vFloorDivide | |
| inducingVariable: #F25 | |
| #F28 isComplete isOriginVariable isStatic vModulo (nameOffset:<null>) (firstTokenOffset:<null>) (offset:335) | |
| element: <testLibrary>::@getter::vModulo | |
| inducingVariable: #F27 | |
| #F30 isComplete isOriginVariable isStatic vGreater (nameOffset:<null>) (firstTokenOffset:<null>) (offset:358) | |
| element: <testLibrary>::@getter::vGreater | |
| inducingVariable: #F29 | |
| #F32 isComplete isOriginVariable isStatic vGreaterEqual (nameOffset:<null>) (firstTokenOffset:<null>) (offset:382) | |
| element: <testLibrary>::@getter::vGreaterEqual | |
| inducingVariable: #F31 | |
| #F34 isComplete isOriginVariable isStatic vLess (nameOffset:<null>) (firstTokenOffset:<null>) (offset:412) | |
| element: <testLibrary>::@getter::vLess | |
| inducingVariable: #F33 | |
| #F36 isComplete isOriginVariable isStatic vLessEqual (nameOffset:<null>) (firstTokenOffset:<null>) (offset:433) | |
| element: <testLibrary>::@getter::vLessEqual | |
| inducingVariable: #F35 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vEqual | |
| reference: <testLibrary>::@topLevelVariable::vEqual | |
| firstFragment: #F1 | |
| type: bool | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vEqual | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vAnd | |
| reference: <testLibrary>::@topLevelVariable::vAnd | |
| firstFragment: #F3 | |
| type: bool | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vAnd | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vOr | |
| reference: <testLibrary>::@topLevelVariable::vOr | |
| firstFragment: #F5 | |
| type: bool | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vOr | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBitXor | |
| reference: <testLibrary>::@topLevelVariable::vBitXor | |
| firstFragment: #F7 | |
| type: int | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_3 | |
| getter: <testLibrary>::@getter::vBitXor | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBitAnd | |
| reference: <testLibrary>::@topLevelVariable::vBitAnd | |
| firstFragment: #F9 | |
| type: int | |
| constantInitializer | |
| fragment: #F9 | |
| expression: expression_4 | |
| getter: <testLibrary>::@getter::vBitAnd | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBitOr | |
| reference: <testLibrary>::@topLevelVariable::vBitOr | |
| firstFragment: #F11 | |
| type: int | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_5 | |
| getter: <testLibrary>::@getter::vBitOr | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBitShiftLeft | |
| reference: <testLibrary>::@topLevelVariable::vBitShiftLeft | |
| firstFragment: #F13 | |
| type: int | |
| constantInitializer | |
| fragment: #F13 | |
| expression: expression_6 | |
| getter: <testLibrary>::@getter::vBitShiftLeft | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBitShiftRight | |
| reference: <testLibrary>::@topLevelVariable::vBitShiftRight | |
| firstFragment: #F15 | |
| type: int | |
| constantInitializer | |
| fragment: #F15 | |
| expression: expression_7 | |
| getter: <testLibrary>::@getter::vBitShiftRight | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vAdd | |
| reference: <testLibrary>::@topLevelVariable::vAdd | |
| firstFragment: #F17 | |
| type: int | |
| constantInitializer | |
| fragment: #F17 | |
| expression: expression_8 | |
| getter: <testLibrary>::@getter::vAdd | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vSubtract | |
| reference: <testLibrary>::@topLevelVariable::vSubtract | |
| firstFragment: #F19 | |
| type: int | |
| constantInitializer | |
| fragment: #F19 | |
| expression: expression_9 | |
| getter: <testLibrary>::@getter::vSubtract | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vMiltiply | |
| reference: <testLibrary>::@topLevelVariable::vMiltiply | |
| firstFragment: #F21 | |
| type: int | |
| constantInitializer | |
| fragment: #F21 | |
| expression: expression_10 | |
| getter: <testLibrary>::@getter::vMiltiply | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDivide | |
| reference: <testLibrary>::@topLevelVariable::vDivide | |
| firstFragment: #F23 | |
| type: double | |
| constantInitializer | |
| fragment: #F23 | |
| expression: expression_11 | |
| getter: <testLibrary>::@getter::vDivide | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vFloorDivide | |
| reference: <testLibrary>::@topLevelVariable::vFloorDivide | |
| firstFragment: #F25 | |
| type: int | |
| constantInitializer | |
| fragment: #F25 | |
| expression: expression_12 | |
| getter: <testLibrary>::@getter::vFloorDivide | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vModulo | |
| reference: <testLibrary>::@topLevelVariable::vModulo | |
| firstFragment: #F27 | |
| type: int | |
| constantInitializer | |
| fragment: #F27 | |
| expression: expression_13 | |
| getter: <testLibrary>::@getter::vModulo | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vGreater | |
| reference: <testLibrary>::@topLevelVariable::vGreater | |
| firstFragment: #F29 | |
| type: bool | |
| constantInitializer | |
| fragment: #F29 | |
| expression: expression_14 | |
| getter: <testLibrary>::@getter::vGreater | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vGreaterEqual | |
| reference: <testLibrary>::@topLevelVariable::vGreaterEqual | |
| firstFragment: #F31 | |
| type: bool | |
| constantInitializer | |
| fragment: #F31 | |
| expression: expression_15 | |
| getter: <testLibrary>::@getter::vGreaterEqual | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vLess | |
| reference: <testLibrary>::@topLevelVariable::vLess | |
| firstFragment: #F33 | |
| type: bool | |
| constantInitializer | |
| fragment: #F33 | |
| expression: expression_16 | |
| getter: <testLibrary>::@getter::vLess | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vLessEqual | |
| reference: <testLibrary>::@topLevelVariable::vLessEqual | |
| firstFragment: #F35 | |
| type: bool | |
| constantInitializer | |
| fragment: #F35 | |
| expression: expression_17 | |
| getter: <testLibrary>::@getter::vLessEqual | |
| getters | |
| isOriginVariable isStatic vEqual | |
| reference: <testLibrary>::@getter::vEqual | |
| firstFragment: #F2 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vEqual | |
| isOriginVariable isStatic vAnd | |
| reference: <testLibrary>::@getter::vAnd | |
| firstFragment: #F4 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vAnd | |
| isOriginVariable isStatic vOr | |
| reference: <testLibrary>::@getter::vOr | |
| firstFragment: #F6 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vOr | |
| isOriginVariable isStatic vBitXor | |
| reference: <testLibrary>::@getter::vBitXor | |
| firstFragment: #F8 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vBitXor | |
| isOriginVariable isStatic vBitAnd | |
| reference: <testLibrary>::@getter::vBitAnd | |
| firstFragment: #F10 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vBitAnd | |
| isOriginVariable isStatic vBitOr | |
| reference: <testLibrary>::@getter::vBitOr | |
| firstFragment: #F12 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vBitOr | |
| isOriginVariable isStatic vBitShiftLeft | |
| reference: <testLibrary>::@getter::vBitShiftLeft | |
| firstFragment: #F14 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vBitShiftLeft | |
| isOriginVariable isStatic vBitShiftRight | |
| reference: <testLibrary>::@getter::vBitShiftRight | |
| firstFragment: #F16 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vBitShiftRight | |
| isOriginVariable isStatic vAdd | |
| reference: <testLibrary>::@getter::vAdd | |
| firstFragment: #F18 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vAdd | |
| isOriginVariable isStatic vSubtract | |
| reference: <testLibrary>::@getter::vSubtract | |
| firstFragment: #F20 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vSubtract | |
| isOriginVariable isStatic vMiltiply | |
| reference: <testLibrary>::@getter::vMiltiply | |
| firstFragment: #F22 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vMiltiply | |
| isOriginVariable isStatic vDivide | |
| reference: <testLibrary>::@getter::vDivide | |
| firstFragment: #F24 | |
| returnType: double | |
| variable: <testLibrary>::@topLevelVariable::vDivide | |
| isOriginVariable isStatic vFloorDivide | |
| reference: <testLibrary>::@getter::vFloorDivide | |
| firstFragment: #F26 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vFloorDivide | |
| isOriginVariable isStatic vModulo | |
| reference: <testLibrary>::@getter::vModulo | |
| firstFragment: #F28 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vModulo | |
| isOriginVariable isStatic vGreater | |
| reference: <testLibrary>::@getter::vGreater | |
| firstFragment: #F30 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vGreater | |
| isOriginVariable isStatic vGreaterEqual | |
| reference: <testLibrary>::@getter::vGreaterEqual | |
| firstFragment: #F32 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vGreaterEqual | |
| isOriginVariable isStatic vLess | |
| reference: <testLibrary>::@getter::vLess | |
| firstFragment: #F34 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vLess | |
| isOriginVariable isStatic vLessEqual | |
| reference: <testLibrary>::@getter::vLessEqual | |
| firstFragment: #F36 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vLessEqual | |
| '''); | |
| } | |
| test_const_topLevel_conditional() async { | |
| var library = await buildLibrary(r''' | |
| const vConditional = (1 == 2) ? 11 : 22; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vConditional (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vConditional | |
| initializer: expression_0 | |
| ConditionalExpression | |
| condition2: ParenthesizedExpression | |
| leftParenthesis: ( @21 | |
| expression2: BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @22 | |
| staticType: int | |
| operator: == @24 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @27 | |
| staticType: int | |
| binaryOperator: equal | |
| element: dart:core::@class::num::@method::== | |
| staticType: bool | |
| expression(v1): BinaryExpression | |
| leftOperand: IntegerLiteral | |
| literal: 1 @22 | |
| staticType: int | |
| operator: == @24 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @27 | |
| staticType: int | |
| element: dart:core::@class::num::@method::== | |
| staticInvokeType: bool Function(Object) | |
| staticType: bool | |
| rightParenthesis: ) @28 | |
| staticType: bool | |
| question: ? @30 | |
| thenExpression2: IntegerLiteral | |
| literal: 11 @32 | |
| staticType: int | |
| colon: : @35 | |
| elseExpression2: IntegerLiteral | |
| literal: 22 @37 | |
| staticType: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vConditional (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vConditional | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vConditional | |
| reference: <testLibrary>::@topLevelVariable::vConditional | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vConditional | |
| getters | |
| isOriginVariable isStatic vConditional | |
| reference: <testLibrary>::@getter::vConditional | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vConditional | |
| '''); | |
| } | |
| test_const_topLevel_identical() async { | |
| var library = await buildLibrary(r''' | |
| const vIdentical = (1 == 2) ? 11 : 22; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIdentical (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vIdentical | |
| initializer: expression_0 | |
| ConditionalExpression | |
| condition2: ParenthesizedExpression | |
| leftParenthesis: ( @19 | |
| expression2: BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @20 | |
| staticType: int | |
| operator: == @22 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @25 | |
| staticType: int | |
| binaryOperator: equal | |
| element: dart:core::@class::num::@method::== | |
| staticType: bool | |
| expression(v1): BinaryExpression | |
| leftOperand: IntegerLiteral | |
| literal: 1 @20 | |
| staticType: int | |
| operator: == @22 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @25 | |
| staticType: int | |
| element: dart:core::@class::num::@method::== | |
| staticInvokeType: bool Function(Object) | |
| staticType: bool | |
| rightParenthesis: ) @26 | |
| staticType: bool | |
| question: ? @28 | |
| thenExpression2: IntegerLiteral | |
| literal: 11 @30 | |
| staticType: int | |
| colon: : @33 | |
| elseExpression2: IntegerLiteral | |
| literal: 22 @35 | |
| staticType: int | |
| staticType: int | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vIdentical (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vIdentical | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIdentical | |
| reference: <testLibrary>::@topLevelVariable::vIdentical | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vIdentical | |
| getters | |
| isOriginVariable isStatic vIdentical | |
| reference: <testLibrary>::@getter::vIdentical | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIdentical | |
| '''); | |
| } | |
| test_const_topLevel_ifNull() async { | |
| var library = await buildLibrary(r''' | |
| const vIfNull = 1 ?? 2.0; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIfNull (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vIfNull | |
| initializer: expression_0 | |
| IfNull | |
| leftOperand: IntegerLiteral | |
| literal: 1 @16 | |
| staticType: int | |
| operator: ?? @18 | |
| rightOperand: DoubleLiteral | |
| literal: 2.0 @21 | |
| staticType: double | |
| staticType: num | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vIfNull (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vIfNull | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIfNull | |
| reference: <testLibrary>::@topLevelVariable::vIfNull | |
| firstFragment: #F1 | |
| type: num | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vIfNull | |
| getters | |
| isOriginVariable isStatic vIfNull | |
| reference: <testLibrary>::@getter::vIfNull | |
| firstFragment: #F2 | |
| returnType: num | |
| variable: <testLibrary>::@topLevelVariable::vIfNull | |
| '''); | |
| } | |
| test_const_topLevel_literal() async { | |
| var library = await buildLibrary(r''' | |
| const vNull = null; | |
| const vBoolFalse = false; | |
| const vBoolTrue = true; | |
| const vIntPositive = 1; | |
| const vIntNegative = -2; | |
| const vIntLong1 = 0x7FFFFFFFFFFFFFFF; | |
| const vIntLong2 = 0xFFFFFFFFFFFFFFFF; | |
| const vIntLong3 = 0x8000000000000000; | |
| const vDouble = 2.3; | |
| const vString = 'abc'; | |
| const vStringConcat = | |
| 'aaa' | |
| 'bbb'; | |
| const vStringInterpolation = 'aaa ${true} ${42} bbb'; | |
| const vSymbol = #aaa.bbb.ccc; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNull (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vNull | |
| initializer: expression_0 | |
| NullLiteral | |
| literal: null @14 | |
| staticType: Null | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBoolFalse (nameOffset:26) (firstTokenOffset:26) (offset:26) | |
| element: <testLibrary>::@topLevelVariable::vBoolFalse | |
| initializer: expression_1 | |
| BooleanLiteral | |
| literal: false @39 | |
| staticType: bool | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vBoolTrue (nameOffset:52) (firstTokenOffset:52) (offset:52) | |
| element: <testLibrary>::@topLevelVariable::vBoolTrue | |
| initializer: expression_2 | |
| BooleanLiteral | |
| literal: true @64 | |
| staticType: bool | |
| inducedGetter: #F6 | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIntPositive (nameOffset:76) (firstTokenOffset:76) (offset:76) | |
| element: <testLibrary>::@topLevelVariable::vIntPositive | |
| initializer: expression_3 | |
| IntegerLiteral | |
| literal: 1 @91 | |
| staticType: int | |
| inducedGetter: #F8 | |
| #F9 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIntNegative (nameOffset:100) (firstTokenOffset:100) (offset:100) | |
| element: <testLibrary>::@topLevelVariable::vIntNegative | |
| initializer: expression_4 | |
| UnaryOperatorInvocation | |
| operator: - @115 | |
| operand: IntegerLiteral | |
| literal: 2 @116 | |
| staticType: int | |
| unaryOperator: negate | |
| element: dart:core::@class::int::@method::unary- | |
| staticType: int | |
| inducedGetter: #F10 | |
| #F11 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIntLong1 (nameOffset:125) (firstTokenOffset:125) (offset:125) | |
| element: <testLibrary>::@topLevelVariable::vIntLong1 | |
| initializer: expression_5 | |
| IntegerLiteral | |
| literal: 0x7FFFFFFFFFFFFFFF @137 | |
| staticType: int | |
| inducedGetter: #F12 | |
| #F13 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIntLong2 (nameOffset:163) (firstTokenOffset:163) (offset:163) | |
| element: <testLibrary>::@topLevelVariable::vIntLong2 | |
| initializer: expression_6 | |
| IntegerLiteral | |
| literal: 0xFFFFFFFFFFFFFFFF @175 | |
| staticType: int | |
| inducedGetter: #F14 | |
| #F15 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vIntLong3 (nameOffset:201) (firstTokenOffset:201) (offset:201) | |
| element: <testLibrary>::@topLevelVariable::vIntLong3 | |
| initializer: expression_7 | |
| IntegerLiteral | |
| literal: 0x8000000000000000 @213 | |
| staticType: int | |
| inducedGetter: #F16 | |
| #F17 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDouble (nameOffset:239) (firstTokenOffset:239) (offset:239) | |
| element: <testLibrary>::@topLevelVariable::vDouble | |
| initializer: expression_8 | |
| DoubleLiteral | |
| literal: 2.3 @249 | |
| staticType: double | |
| inducedGetter: #F18 | |
| #F19 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vString (nameOffset:260) (firstTokenOffset:260) (offset:260) | |
| element: <testLibrary>::@topLevelVariable::vString | |
| initializer: expression_9 | |
| SimpleStringLiteral | |
| literal: 'abc' @270 | |
| inducedGetter: #F20 | |
| #F21 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vStringConcat (nameOffset:283) (firstTokenOffset:283) (offset:283) | |
| element: <testLibrary>::@topLevelVariable::vStringConcat | |
| initializer: expression_10 | |
| AdjacentStrings | |
| strings | |
| SimpleStringLiteral | |
| literal: 'aaa' @303 | |
| SimpleStringLiteral | |
| literal: 'bbb' @313 | |
| staticType: String | |
| stringValue: aaabbb | |
| inducedGetter: #F22 | |
| #F23 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vStringInterpolation (nameOffset:326) (firstTokenOffset:326) (offset:326) | |
| element: <testLibrary>::@topLevelVariable::vStringInterpolation | |
| initializer: expression_11 | |
| StringInterpolation | |
| elements | |
| InterpolationString | |
| contents: 'aaa @349 | |
| InterpolationExpression | |
| leftBracket: ${ @354 | |
| expression2: BooleanLiteral | |
| literal: true @356 | |
| staticType: bool | |
| rightBracket: } @360 | |
| InterpolationString | |
| contents: @361 | |
| InterpolationExpression | |
| leftBracket: ${ @362 | |
| expression2: IntegerLiteral | |
| literal: 42 @364 | |
| staticType: int | |
| rightBracket: } @366 | |
| InterpolationString | |
| contents: bbb' @367 | |
| staticType: String | |
| stringValue: null | |
| inducedGetter: #F24 | |
| #F25 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vSymbol (nameOffset:380) (firstTokenOffset:380) (offset:380) | |
| element: <testLibrary>::@topLevelVariable::vSymbol | |
| initializer: expression_12 | |
| SymbolLiteral | |
| poundSign: # @390 | |
| components | |
| aaa @391 | |
| bbb @395 | |
| ccc @399 | |
| inducedGetter: #F26 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vNull (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vNull | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vBoolFalse (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26) | |
| element: <testLibrary>::@getter::vBoolFalse | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vBoolTrue (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52) | |
| element: <testLibrary>::@getter::vBoolTrue | |
| inducingVariable: #F5 | |
| #F8 isComplete isOriginVariable isStatic vIntPositive (nameOffset:<null>) (firstTokenOffset:<null>) (offset:76) | |
| element: <testLibrary>::@getter::vIntPositive | |
| inducingVariable: #F7 | |
| #F10 isComplete isOriginVariable isStatic vIntNegative (nameOffset:<null>) (firstTokenOffset:<null>) (offset:100) | |
| element: <testLibrary>::@getter::vIntNegative | |
| inducingVariable: #F9 | |
| #F12 isComplete isOriginVariable isStatic vIntLong1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:125) | |
| element: <testLibrary>::@getter::vIntLong1 | |
| inducingVariable: #F11 | |
| #F14 isComplete isOriginVariable isStatic vIntLong2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:163) | |
| element: <testLibrary>::@getter::vIntLong2 | |
| inducingVariable: #F13 | |
| #F16 isComplete isOriginVariable isStatic vIntLong3 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:201) | |
| element: <testLibrary>::@getter::vIntLong3 | |
| inducingVariable: #F15 | |
| #F18 isComplete isOriginVariable isStatic vDouble (nameOffset:<null>) (firstTokenOffset:<null>) (offset:239) | |
| element: <testLibrary>::@getter::vDouble | |
| inducingVariable: #F17 | |
| #F20 isComplete isOriginVariable isStatic vString (nameOffset:<null>) (firstTokenOffset:<null>) (offset:260) | |
| element: <testLibrary>::@getter::vString | |
| inducingVariable: #F19 | |
| #F22 isComplete isOriginVariable isStatic vStringConcat (nameOffset:<null>) (firstTokenOffset:<null>) (offset:283) | |
| element: <testLibrary>::@getter::vStringConcat | |
| inducingVariable: #F21 | |
| #F24 isComplete isOriginVariable isStatic vStringInterpolation (nameOffset:<null>) (firstTokenOffset:<null>) (offset:326) | |
| element: <testLibrary>::@getter::vStringInterpolation | |
| inducingVariable: #F23 | |
| #F26 isComplete isOriginVariable isStatic vSymbol (nameOffset:<null>) (firstTokenOffset:<null>) (offset:380) | |
| element: <testLibrary>::@getter::vSymbol | |
| inducingVariable: #F25 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNull | |
| reference: <testLibrary>::@topLevelVariable::vNull | |
| firstFragment: #F1 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vNull | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBoolFalse | |
| reference: <testLibrary>::@topLevelVariable::vBoolFalse | |
| firstFragment: #F3 | |
| type: bool | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vBoolFalse | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vBoolTrue | |
| reference: <testLibrary>::@topLevelVariable::vBoolTrue | |
| firstFragment: #F5 | |
| type: bool | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vBoolTrue | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIntPositive | |
| reference: <testLibrary>::@topLevelVariable::vIntPositive | |
| firstFragment: #F7 | |
| type: int | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_3 | |
| getter: <testLibrary>::@getter::vIntPositive | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIntNegative | |
| reference: <testLibrary>::@topLevelVariable::vIntNegative | |
| firstFragment: #F9 | |
| type: int | |
| constantInitializer | |
| fragment: #F9 | |
| expression: expression_4 | |
| getter: <testLibrary>::@getter::vIntNegative | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIntLong1 | |
| reference: <testLibrary>::@topLevelVariable::vIntLong1 | |
| firstFragment: #F11 | |
| type: int | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_5 | |
| getter: <testLibrary>::@getter::vIntLong1 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIntLong2 | |
| reference: <testLibrary>::@topLevelVariable::vIntLong2 | |
| firstFragment: #F13 | |
| type: int | |
| constantInitializer | |
| fragment: #F13 | |
| expression: expression_6 | |
| getter: <testLibrary>::@getter::vIntLong2 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vIntLong3 | |
| reference: <testLibrary>::@topLevelVariable::vIntLong3 | |
| firstFragment: #F15 | |
| type: int | |
| constantInitializer | |
| fragment: #F15 | |
| expression: expression_7 | |
| getter: <testLibrary>::@getter::vIntLong3 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDouble | |
| reference: <testLibrary>::@topLevelVariable::vDouble | |
| firstFragment: #F17 | |
| type: double | |
| constantInitializer | |
| fragment: #F17 | |
| expression: expression_8 | |
| getter: <testLibrary>::@getter::vDouble | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vString | |
| reference: <testLibrary>::@topLevelVariable::vString | |
| firstFragment: #F19 | |
| type: String | |
| constantInitializer | |
| fragment: #F19 | |
| expression: expression_9 | |
| getter: <testLibrary>::@getter::vString | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vStringConcat | |
| reference: <testLibrary>::@topLevelVariable::vStringConcat | |
| firstFragment: #F21 | |
| type: String | |
| constantInitializer | |
| fragment: #F21 | |
| expression: expression_10 | |
| getter: <testLibrary>::@getter::vStringConcat | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vStringInterpolation | |
| reference: <testLibrary>::@topLevelVariable::vStringInterpolation | |
| firstFragment: #F23 | |
| type: String | |
| constantInitializer | |
| fragment: #F23 | |
| expression: expression_11 | |
| getter: <testLibrary>::@getter::vStringInterpolation | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vSymbol | |
| reference: <testLibrary>::@topLevelVariable::vSymbol | |
| firstFragment: #F25 | |
| type: Symbol | |
| constantInitializer | |
| fragment: #F25 | |
| expression: expression_12 | |
| getter: <testLibrary>::@getter::vSymbol | |
| getters | |
| isOriginVariable isStatic vNull | |
| reference: <testLibrary>::@getter::vNull | |
| firstFragment: #F2 | |
| returnType: dynamic | |
| variable: <testLibrary>::@topLevelVariable::vNull | |
| isOriginVariable isStatic vBoolFalse | |
| reference: <testLibrary>::@getter::vBoolFalse | |
| firstFragment: #F4 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vBoolFalse | |
| isOriginVariable isStatic vBoolTrue | |
| reference: <testLibrary>::@getter::vBoolTrue | |
| firstFragment: #F6 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vBoolTrue | |
| isOriginVariable isStatic vIntPositive | |
| reference: <testLibrary>::@getter::vIntPositive | |
| firstFragment: #F8 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIntPositive | |
| isOriginVariable isStatic vIntNegative | |
| reference: <testLibrary>::@getter::vIntNegative | |
| firstFragment: #F10 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIntNegative | |
| isOriginVariable isStatic vIntLong1 | |
| reference: <testLibrary>::@getter::vIntLong1 | |
| firstFragment: #F12 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIntLong1 | |
| isOriginVariable isStatic vIntLong2 | |
| reference: <testLibrary>::@getter::vIntLong2 | |
| firstFragment: #F14 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIntLong2 | |
| isOriginVariable isStatic vIntLong3 | |
| reference: <testLibrary>::@getter::vIntLong3 | |
| firstFragment: #F16 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIntLong3 | |
| isOriginVariable isStatic vDouble | |
| reference: <testLibrary>::@getter::vDouble | |
| firstFragment: #F18 | |
| returnType: double | |
| variable: <testLibrary>::@topLevelVariable::vDouble | |
| isOriginVariable isStatic vString | |
| reference: <testLibrary>::@getter::vString | |
| firstFragment: #F20 | |
| returnType: String | |
| variable: <testLibrary>::@topLevelVariable::vString | |
| isOriginVariable isStatic vStringConcat | |
| reference: <testLibrary>::@getter::vStringConcat | |
| firstFragment: #F22 | |
| returnType: String | |
| variable: <testLibrary>::@topLevelVariable::vStringConcat | |
| isOriginVariable isStatic vStringInterpolation | |
| reference: <testLibrary>::@getter::vStringInterpolation | |
| firstFragment: #F24 | |
| returnType: String | |
| variable: <testLibrary>::@topLevelVariable::vStringInterpolation | |
| isOriginVariable isStatic vSymbol | |
| reference: <testLibrary>::@getter::vSymbol | |
| firstFragment: #F26 | |
| returnType: Symbol | |
| variable: <testLibrary>::@topLevelVariable::vSymbol | |
| '''); | |
| } | |
| test_const_topLevel_methodInvocation_questionPeriod() async { | |
| var library = await buildLibrary(r''' | |
| const int? a = 0; | |
| const b = a?.toString(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @15 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| ReceiverMethodInvocation | |
| receiver: UnqualifiedNameExpression | |
| name: a @28 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int? Function() | |
| type: int? | |
| staticType: int? | |
| operator: ?. @29 | |
| name: toString @31 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @39 | |
| rightParenthesis: ) @40 | |
| resolution: ExecutableInvocationResolution | |
| element: dart:core::@class::int::@method::toString | |
| invokeType: String Function() | |
| type: String | |
| staticType: String? | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int? | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: String? | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int? | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: String? | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_topLevel_methodInvocation_questionPeriodPeriod() async { | |
| var library = await buildLibrary(r''' | |
| const int? a = 0; | |
| const b = a?..toString(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:11) (firstTokenOffset:11) (offset:11) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| IntegerLiteral | |
| literal: 0 @15 | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| CascadeExpression | |
| target2: UnqualifiedNameExpression | |
| name: a @28 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: int? Function() | |
| type: int? | |
| staticType: int? | |
| target(v1): SimpleIdentifier | |
| token: a @28 | |
| element: <testLibrary>::@getter::a | |
| staticType: int? | |
| sections | |
| CascadeSection | |
| operator: ?.. @29 | |
| body: CascadeMethodInvocation | |
| name: toString @32 | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @40 | |
| rightParenthesis: ) @41 | |
| resolution: ExecutableInvocationResolution | |
| element: dart:core::@class::int::@method::toString | |
| invokeType: String Function() | |
| type: String | |
| staticType: String | |
| cascadeSections | |
| MethodInvocation | |
| operator: ?.. @29 | |
| methodName: SimpleIdentifier | |
| token: toString @32 | |
| element: dart:core::@class::int::@method::toString | |
| staticType: String Function() | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @40 | |
| rightParenthesis: ) @41 | |
| staticInvokeType: String Function() | |
| staticType: String | |
| staticType: int? | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:11) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: int? | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: int? | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: int? | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: int? | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_topLevel_nullAware_propertyAccess() async { | |
| var library = await buildLibrary(r''' | |
| const String? a = ''; | |
| const List<int?> b = [a?.length]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:14) (firstTokenOffset:14) (offset:14) | |
| element: <testLibrary>::@topLevelVariable::a | |
| initializer: expression_0 | |
| SimpleStringLiteral | |
| literal: '' @18 | |
| inducedGetter: #F2 | |
| #F3 hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:40) (firstTokenOffset:40) (offset:40) | |
| element: <testLibrary>::@topLevelVariable::b | |
| initializer: expression_1 | |
| ListLiteral | |
| leftBracket: [ @44 | |
| elements2 | |
| ReceiverPropertyExtraction | |
| receiver: UnqualifiedNameExpression | |
| name: a @45 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@getter::a | |
| invokeType: String? Function() | |
| type: String? | |
| staticType: String? | |
| operator: ?. @46 | |
| name: length @48 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int? | |
| elements(v1) | |
| PropertyAccess | |
| target: SimpleIdentifier | |
| token: a @45 | |
| element: <testLibrary>::@getter::a | |
| staticType: String? | |
| operator: ?. @46 | |
| propertyName: SimpleIdentifier | |
| token: length @48 | |
| element: dart:core::@class::String::@getter::length | |
| staticType: int | |
| staticType: int? | |
| rightBracket: ] @54 | |
| staticType: List<int?> | |
| inducedGetter: #F4 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:14) | |
| element: <testLibrary>::@getter::a | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:40) | |
| element: <testLibrary>::@getter::b | |
| inducingVariable: #F3 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic a | |
| reference: <testLibrary>::@topLevelVariable::a | |
| firstFragment: #F1 | |
| type: String? | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::a | |
| hasInitializer isConst isOriginDeclaration isStatic b | |
| reference: <testLibrary>::@topLevelVariable::b | |
| firstFragment: #F3 | |
| type: List<int?> | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::b | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@getter::a | |
| firstFragment: #F2 | |
| returnType: String? | |
| variable: <testLibrary>::@topLevelVariable::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@getter::b | |
| firstFragment: #F4 | |
| returnType: List<int?> | |
| variable: <testLibrary>::@topLevelVariable::b | |
| '''); | |
| } | |
| test_const_topLevel_parenthesis() async { | |
| var library = await buildLibrary(r''' | |
| const int v1 = (1 + 2) * 3; | |
| const int v2 = -(1 + 2); | |
| const int v3 = ('aaa' + 'bbb').length; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasInitializer isConst isOriginDeclaration isStatic v1 (nameOffset:10) (firstTokenOffset:10) (offset:10) | |
| element: <testLibrary>::@topLevelVariable::v1 | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: ParenthesizedExpression | |
| leftParenthesis: ( @15 | |
| expression2: BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @16 | |
| staticType: int | |
| operator: + @18 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @20 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| expression(v1): BinaryExpression | |
| leftOperand: IntegerLiteral | |
| literal: 1 @16 | |
| staticType: int | |
| operator: + @18 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @20 | |
| staticType: int | |
| element: dart:core::@class::num::@method::+ | |
| staticInvokeType: num Function(num) | |
| staticType: int | |
| rightParenthesis: ) @21 | |
| staticType: int | |
| operator: * @23 | |
| rightOperand: IntegerLiteral | |
| literal: 3 @25 | |
| staticType: int | |
| binaryOperator: multiply | |
| element: dart:core::@class::num::@method::* | |
| staticType: int | |
| inducedGetter: #F2 | |
| #F3 hasInitializer isConst isOriginDeclaration isStatic v2 (nameOffset:38) (firstTokenOffset:38) (offset:38) | |
| element: <testLibrary>::@topLevelVariable::v2 | |
| initializer: expression_1 | |
| UnaryOperatorInvocation | |
| operator: - @43 | |
| operand: ParenthesizedExpression | |
| leftParenthesis: ( @44 | |
| expression2: BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @45 | |
| staticType: int | |
| operator: + @47 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @49 | |
| staticType: int | |
| binaryOperator: add | |
| element: dart:core::@class::num::@method::+ | |
| staticType: int | |
| expression(v1): BinaryExpression | |
| leftOperand: IntegerLiteral | |
| literal: 1 @45 | |
| staticType: int | |
| operator: + @47 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @49 | |
| staticType: int | |
| element: dart:core::@class::num::@method::+ | |
| staticInvokeType: num Function(num) | |
| staticType: int | |
| rightParenthesis: ) @50 | |
| staticType: int | |
| unaryOperator: negate | |
| element: dart:core::@class::int::@method::unary- | |
| staticType: int | |
| inducedGetter: #F4 | |
| #F5 hasInitializer isConst isOriginDeclaration isStatic v3 (nameOffset:63) (firstTokenOffset:63) (offset:63) | |
| element: <testLibrary>::@topLevelVariable::v3 | |
| initializer: expression_2 | |
| ReceiverPropertyExtraction | |
| receiver: ParenthesizedExpression | |
| leftParenthesis: ( @68 | |
| expression2: BinaryOperatorInvocation | |
| leftOperand: SimpleStringLiteral | |
| literal: 'aaa' @69 | |
| operator: + @75 | |
| rightOperand: SimpleStringLiteral | |
| literal: 'bbb' @77 | |
| binaryOperator: add | |
| element: dart:core::@class::String::@method::+ | |
| staticType: String | |
| expression(v1): BinaryExpression | |
| leftOperand: SimpleStringLiteral | |
| literal: 'aaa' @69 | |
| operator: + @75 | |
| rightOperand: SimpleStringLiteral | |
| literal: 'bbb' @77 | |
| element: dart:core::@class::String::@method::+ | |
| staticInvokeType: String Function(String) | |
| staticType: String | |
| rightParenthesis: ) @82 | |
| staticType: String | |
| operator: . @83 | |
| name: length @84 | |
| resolution: GetterInvocationResolution | |
| element: dart:core::@class::String::@getter::length | |
| invokeType: int Function() | |
| type: int | |
| staticType: int | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:10) | |
| element: <testLibrary>::@getter::v1 | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic v2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:38) | |
| element: <testLibrary>::@getter::v2 | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic v3 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:63) | |
| element: <testLibrary>::@getter::v3 | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasInitializer isConst isOriginDeclaration isStatic v1 | |
| reference: <testLibrary>::@topLevelVariable::v1 | |
| firstFragment: #F1 | |
| type: int | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v1 | |
| hasInitializer isConst isOriginDeclaration isStatic v2 | |
| reference: <testLibrary>::@topLevelVariable::v2 | |
| firstFragment: #F3 | |
| type: int | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::v2 | |
| hasInitializer isConst isOriginDeclaration isStatic v3 | |
| reference: <testLibrary>::@topLevelVariable::v3 | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::v3 | |
| getters | |
| isOriginVariable isStatic v1 | |
| reference: <testLibrary>::@getter::v1 | |
| firstFragment: #F2 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v1 | |
| isOriginVariable isStatic v2 | |
| reference: <testLibrary>::@getter::v2 | |
| firstFragment: #F4 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v2 | |
| isOriginVariable isStatic v3 | |
| reference: <testLibrary>::@getter::v3 | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::v3 | |
| '''); | |
| } | |
| test_const_topLevel_prefix() async { | |
| var library = await buildLibrary(r''' | |
| const vNotEqual = 1 != 2; | |
| const vNot = !true; | |
| const vNegate = -1; | |
| const vComplement = ~1; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNotEqual (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vNotEqual | |
| initializer: expression_0 | |
| BinaryOperatorInvocation | |
| leftOperand: IntegerLiteral | |
| literal: 1 @18 | |
| staticType: int | |
| operator: != @20 | |
| rightOperand: IntegerLiteral | |
| literal: 2 @23 | |
| staticType: int | |
| binaryOperator: notEqual | |
| element: dart:core::@class::num::@method::== | |
| staticType: bool | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNot (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::vNot | |
| initializer: expression_1 | |
| LogicalNot | |
| operator: ! @39 | |
| operand: BooleanLiteral | |
| literal: true @40 | |
| staticType: bool | |
| staticType: bool | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNegate (nameOffset:52) (firstTokenOffset:52) (offset:52) | |
| element: <testLibrary>::@topLevelVariable::vNegate | |
| initializer: expression_2 | |
| UnaryOperatorInvocation | |
| operator: - @62 | |
| operand: IntegerLiteral | |
| literal: 1 @63 | |
| staticType: int | |
| unaryOperator: negate | |
| element: dart:core::@class::int::@method::unary- | |
| staticType: int | |
| inducedGetter: #F6 | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vComplement (nameOffset:72) (firstTokenOffset:72) (offset:72) | |
| element: <testLibrary>::@topLevelVariable::vComplement | |
| initializer: expression_3 | |
| UnaryOperatorInvocation | |
| operator: ~ @86 | |
| operand: IntegerLiteral | |
| literal: 1 @87 | |
| staticType: int | |
| unaryOperator: bitwiseComplement | |
| element: dart:core::@class::int::@method::~ | |
| staticType: int | |
| inducedGetter: #F8 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vNotEqual (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vNotEqual | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vNot (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::vNot | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vNegate (nameOffset:<null>) (firstTokenOffset:<null>) (offset:52) | |
| element: <testLibrary>::@getter::vNegate | |
| inducingVariable: #F5 | |
| #F8 isComplete isOriginVariable isStatic vComplement (nameOffset:<null>) (firstTokenOffset:<null>) (offset:72) | |
| element: <testLibrary>::@getter::vComplement | |
| inducingVariable: #F7 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNotEqual | |
| reference: <testLibrary>::@topLevelVariable::vNotEqual | |
| firstFragment: #F1 | |
| type: bool | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vNotEqual | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNot | |
| reference: <testLibrary>::@topLevelVariable::vNot | |
| firstFragment: #F3 | |
| type: bool | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vNot | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNegate | |
| reference: <testLibrary>::@topLevelVariable::vNegate | |
| firstFragment: #F5 | |
| type: int | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vNegate | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vComplement | |
| reference: <testLibrary>::@topLevelVariable::vComplement | |
| firstFragment: #F7 | |
| type: int | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_3 | |
| getter: <testLibrary>::@getter::vComplement | |
| getters | |
| isOriginVariable isStatic vNotEqual | |
| reference: <testLibrary>::@getter::vNotEqual | |
| firstFragment: #F2 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vNotEqual | |
| isOriginVariable isStatic vNot | |
| reference: <testLibrary>::@getter::vNot | |
| firstFragment: #F4 | |
| returnType: bool | |
| variable: <testLibrary>::@topLevelVariable::vNot | |
| isOriginVariable isStatic vNegate | |
| reference: <testLibrary>::@getter::vNegate | |
| firstFragment: #F6 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vNegate | |
| isOriginVariable isStatic vComplement | |
| reference: <testLibrary>::@getter::vComplement | |
| firstFragment: #F8 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vComplement | |
| '''); | |
| } | |
| test_const_topLevel_super() async { | |
| var library = await buildLibrary(r''' | |
| const vSuper = super; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vSuper (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vSuper | |
| initializer: expression_0 | |
| InvalidSuperExpression | |
| superReference: SuperReference | |
| superKeyword: super @15 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vSuper (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vSuper | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vSuper | |
| reference: <testLibrary>::@topLevelVariable::vSuper | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vSuper | |
| getters | |
| isOriginVariable isStatic vSuper | |
| reference: <testLibrary>::@getter::vSuper | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::vSuper | |
| '''); | |
| } | |
| test_const_topLevel_this() async { | |
| var library = await buildLibrary(r''' | |
| const vThis = this; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vThis (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vThis | |
| initializer: expression_0 | |
| ThisExpression | |
| thisKeyword: this @14 | |
| staticType: InvalidType | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vThis (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vThis | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vThis | |
| reference: <testLibrary>::@topLevelVariable::vThis | |
| firstFragment: #F1 | |
| type: InvalidType | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vThis | |
| getters | |
| isOriginVariable isStatic vThis | |
| reference: <testLibrary>::@getter::vThis | |
| firstFragment: #F2 | |
| returnType: InvalidType | |
| variable: <testLibrary>::@topLevelVariable::vThis | |
| '''); | |
| } | |
| test_const_topLevel_throw() async { | |
| var library = await buildLibrary(r''' | |
| const c = throw 42; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic c (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::c | |
| initializer: expression_0 | |
| ThrowExpression | |
| throwKeyword: throw @10 | |
| expression2: IntegerLiteral | |
| literal: 42 @16 | |
| staticType: int | |
| staticType: Never | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::c | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@topLevelVariable::c | |
| firstFragment: #F1 | |
| type: Never | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::c | |
| getters | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@getter::c | |
| firstFragment: #F2 | |
| returnType: Never | |
| variable: <testLibrary>::@topLevelVariable::c | |
| '''); | |
| } | |
| test_const_topLevel_typedList() async { | |
| var library = await buildLibrary(r''' | |
| const vNull = const <Null>[]; | |
| const vDynamic = const <dynamic>[1, 2, 3]; | |
| const vInterfaceNoTypeParameters = const <int>[1, 2, 3]; | |
| const vInterfaceNoTypeArguments = const <List>[]; | |
| const vInterfaceWithTypeArguments = const <List<String>>[]; | |
| const vInterfaceWithTypeArguments2 = const <Map<int, List<String>>>[]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vNull (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vNull | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @14 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @20 | |
| arguments | |
| NamedType | |
| name: Null @21 | |
| element: dart:core::@class::Null | |
| type: Null | |
| rightBracket: > @25 | |
| leftBracket: [ @26 | |
| rightBracket: ] @27 | |
| staticType: List<Null> | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDynamic (nameOffset:36) (firstTokenOffset:36) (offset:36) | |
| element: <testLibrary>::@topLevelVariable::vDynamic | |
| initializer: expression_1 | |
| ListLiteral | |
| constKeyword: const @47 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @53 | |
| arguments | |
| NamedType | |
| name: dynamic @54 | |
| element: dynamic | |
| type: dynamic | |
| rightBracket: > @61 | |
| leftBracket: [ @62 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @63 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 2 @66 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 3 @69 | |
| staticType: int | |
| rightBracket: ] @70 | |
| staticType: List<dynamic> | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceNoTypeParameters (nameOffset:79) (firstTokenOffset:79) (offset:79) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceNoTypeParameters | |
| initializer: expression_2 | |
| ListLiteral | |
| constKeyword: const @108 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @114 | |
| arguments | |
| NamedType | |
| name: int @115 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @118 | |
| leftBracket: [ @119 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @120 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 2 @123 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 3 @126 | |
| staticType: int | |
| rightBracket: ] @127 | |
| staticType: List<int> | |
| inducedGetter: #F6 | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceNoTypeArguments (nameOffset:136) (firstTokenOffset:136) (offset:136) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceNoTypeArguments | |
| initializer: expression_3 | |
| ListLiteral | |
| constKeyword: const @164 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @170 | |
| arguments | |
| NamedType | |
| name: List @171 | |
| element: dart:core::@class::List | |
| type: List<dynamic> | |
| rightBracket: > @175 | |
| leftBracket: [ @176 | |
| rightBracket: ] @177 | |
| staticType: List<List<dynamic>> | |
| inducedGetter: #F8 | |
| #F9 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceWithTypeArguments (nameOffset:186) (firstTokenOffset:186) (offset:186) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| initializer: expression_4 | |
| ListLiteral | |
| constKeyword: const @216 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @222 | |
| arguments | |
| NamedType | |
| name: List @223 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @227 | |
| arguments | |
| NamedType | |
| name: String @228 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @234 | |
| element: dart:core::@class::List | |
| type: List<String> | |
| rightBracket: > @235 | |
| leftBracket: [ @236 | |
| rightBracket: ] @237 | |
| staticType: List<List<String>> | |
| inducedGetter: #F10 | |
| #F11 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceWithTypeArguments2 (nameOffset:246) (firstTokenOffset:246) (offset:246) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments2 | |
| initializer: expression_5 | |
| ListLiteral | |
| constKeyword: const @277 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @283 | |
| arguments | |
| NamedType | |
| name: Map @284 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @287 | |
| arguments | |
| NamedType | |
| name: int @288 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: List @293 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @297 | |
| arguments | |
| NamedType | |
| name: String @298 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @304 | |
| element: dart:core::@class::List | |
| type: List<String> | |
| rightBracket: > @305 | |
| element: dart:core::@class::Map | |
| type: Map<int, List<String>> | |
| rightBracket: > @306 | |
| leftBracket: [ @307 | |
| rightBracket: ] @308 | |
| staticType: List<Map<int, List<String>>> | |
| inducedGetter: #F12 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vNull (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vNull | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vDynamic (nameOffset:<null>) (firstTokenOffset:<null>) (offset:36) | |
| element: <testLibrary>::@getter::vDynamic | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vInterfaceNoTypeParameters (nameOffset:<null>) (firstTokenOffset:<null>) (offset:79) | |
| element: <testLibrary>::@getter::vInterfaceNoTypeParameters | |
| inducingVariable: #F5 | |
| #F8 isComplete isOriginVariable isStatic vInterfaceNoTypeArguments (nameOffset:<null>) (firstTokenOffset:<null>) (offset:136) | |
| element: <testLibrary>::@getter::vInterfaceNoTypeArguments | |
| inducingVariable: #F7 | |
| #F10 isComplete isOriginVariable isStatic vInterfaceWithTypeArguments (nameOffset:<null>) (firstTokenOffset:<null>) (offset:186) | |
| element: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| inducingVariable: #F9 | |
| #F12 isComplete isOriginVariable isStatic vInterfaceWithTypeArguments2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:246) | |
| element: <testLibrary>::@getter::vInterfaceWithTypeArguments2 | |
| inducingVariable: #F11 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vNull | |
| reference: <testLibrary>::@topLevelVariable::vNull | |
| firstFragment: #F1 | |
| type: List<Null> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vNull | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDynamic | |
| reference: <testLibrary>::@topLevelVariable::vDynamic | |
| firstFragment: #F3 | |
| type: List<dynamic> | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vDynamic | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceNoTypeParameters | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceNoTypeParameters | |
| firstFragment: #F5 | |
| type: List<int> | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vInterfaceNoTypeParameters | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceNoTypeArguments | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceNoTypeArguments | |
| firstFragment: #F7 | |
| type: List<List<dynamic>> | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_3 | |
| getter: <testLibrary>::@getter::vInterfaceNoTypeArguments | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| firstFragment: #F9 | |
| type: List<List<String>> | |
| constantInitializer | |
| fragment: #F9 | |
| expression: expression_4 | |
| getter: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceWithTypeArguments2 | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments2 | |
| firstFragment: #F11 | |
| type: List<Map<int, List<String>>> | |
| constantInitializer | |
| fragment: #F11 | |
| expression: expression_5 | |
| getter: <testLibrary>::@getter::vInterfaceWithTypeArguments2 | |
| getters | |
| isOriginVariable isStatic vNull | |
| reference: <testLibrary>::@getter::vNull | |
| firstFragment: #F2 | |
| returnType: List<Null> | |
| variable: <testLibrary>::@topLevelVariable::vNull | |
| isOriginVariable isStatic vDynamic | |
| reference: <testLibrary>::@getter::vDynamic | |
| firstFragment: #F4 | |
| returnType: List<dynamic> | |
| variable: <testLibrary>::@topLevelVariable::vDynamic | |
| isOriginVariable isStatic vInterfaceNoTypeParameters | |
| reference: <testLibrary>::@getter::vInterfaceNoTypeParameters | |
| firstFragment: #F6 | |
| returnType: List<int> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceNoTypeParameters | |
| isOriginVariable isStatic vInterfaceNoTypeArguments | |
| reference: <testLibrary>::@getter::vInterfaceNoTypeArguments | |
| firstFragment: #F8 | |
| returnType: List<List<dynamic>> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceNoTypeArguments | |
| isOriginVariable isStatic vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| firstFragment: #F10 | |
| returnType: List<List<String>> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| isOriginVariable isStatic vInterfaceWithTypeArguments2 | |
| reference: <testLibrary>::@getter::vInterfaceWithTypeArguments2 | |
| firstFragment: #F12 | |
| returnType: List<Map<int, List<String>>> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments2 | |
| '''); | |
| } | |
| test_const_topLevel_typedList_imported() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C {} | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart'; | |
| const v = const <C>[]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:24) (firstTokenOffset:24) (offset:24) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @28 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @34 | |
| arguments | |
| NamedType | |
| name: C @35 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| rightBracket: > @36 | |
| leftBracket: [ @37 | |
| rightBracket: ] @38 | |
| staticType: List<C> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:24) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: List<C> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: List<C> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_topLevel_typedList_importedWithPrefix() async { | |
| newFile('$testPackageLibPath/a.dart', r''' | |
| class C {} | |
| '''); | |
| var library = await buildLibrary(r''' | |
| import 'a.dart' as p; | |
| const v = const <p.C>[]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| libraryImports | |
| package:test/a.dart as p (nameOffset:19) (firstTokenOffset:<null>) (offset:19) | |
| prefixes | |
| <testLibraryFragment>::@prefix::p | |
| fragments: @19 | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:29) (firstTokenOffset:29) (offset:29) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @33 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @39 | |
| arguments | |
| NamedType | |
| importPrefix: ImportPrefixReference | |
| name: p @40 | |
| period: . @41 | |
| element: <testLibraryFragment>::@prefix::p | |
| name: C @42 | |
| element: package:test/a.dart::@class::C | |
| type: C | |
| rightBracket: > @43 | |
| leftBracket: [ @44 | |
| rightBracket: ] @45 | |
| staticType: List<C> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:29) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: List<C> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: List<C> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_topLevel_typedList_typedefArgument() async { | |
| var library = await buildLibrary(r''' | |
| typedef int F(String id); | |
| const v = const <F>[]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| typeAliases | |
| #F1 F (nameOffset:12) (firstTokenOffset:0) (offset:12) | |
| element: <testLibrary>::@typeAlias::F | |
| topLevelVariables | |
| #F2 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:32) (firstTokenOffset:32) (offset:32) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @36 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @42 | |
| arguments | |
| NamedType | |
| name: F @43 | |
| element: <testLibrary>::@typeAlias::F | |
| type: int Function(String) | |
| alias: <testLibrary>::@typeAlias::F | |
| rightBracket: > @44 | |
| leftBracket: [ @45 | |
| rightBracket: ] @46 | |
| staticType: List<int Function(String)> | |
| inducedGetter: #F3 | |
| getters | |
| #F3 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:32) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F2 | |
| typeAliases | |
| isSimplyBounded F | |
| reference: <testLibrary>::@typeAlias::F | |
| firstFragment: #F1 | |
| aliasedType: int Function(String) | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F2 | |
| type: List<int Function(String)> | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F3 | |
| returnType: List<int Function(String)> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_topLevel_typedMap() async { | |
| var library = await buildLibrary(r''' | |
| const vDynamic1 = const <dynamic, int>{}; | |
| const vDynamic2 = const <int, dynamic>{}; | |
| const vInterface = const <int, String>{}; | |
| const vInterfaceWithTypeArguments = const <int, List<String>>{}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDynamic1 (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vDynamic1 | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @18 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @24 | |
| arguments | |
| NamedType | |
| name: dynamic @25 | |
| element: dynamic | |
| type: dynamic | |
| NamedType | |
| name: int @34 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @37 | |
| leftBracket: { @38 | |
| rightBracket: } @39 | |
| isMap: true | |
| staticType: Map<dynamic, int> | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDynamic2 (nameOffset:48) (firstTokenOffset:48) (offset:48) | |
| element: <testLibrary>::@topLevelVariable::vDynamic2 | |
| initializer: expression_1 | |
| SetOrMapLiteral | |
| constKeyword: const @60 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @66 | |
| arguments | |
| NamedType | |
| name: int @67 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: dynamic @72 | |
| element: dynamic | |
| type: dynamic | |
| rightBracket: > @79 | |
| leftBracket: { @80 | |
| rightBracket: } @81 | |
| isMap: true | |
| staticType: Map<int, dynamic> | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterface (nameOffset:90) (firstTokenOffset:90) (offset:90) | |
| element: <testLibrary>::@topLevelVariable::vInterface | |
| initializer: expression_2 | |
| SetOrMapLiteral | |
| constKeyword: const @103 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @109 | |
| arguments | |
| NamedType | |
| name: int @110 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: String @115 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @121 | |
| leftBracket: { @122 | |
| rightBracket: } @123 | |
| isMap: true | |
| staticType: Map<int, String> | |
| inducedGetter: #F6 | |
| #F7 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceWithTypeArguments (nameOffset:132) (firstTokenOffset:132) (offset:132) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| initializer: expression_3 | |
| SetOrMapLiteral | |
| constKeyword: const @162 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @168 | |
| arguments | |
| NamedType | |
| name: int @169 | |
| element: dart:core::@class::int | |
| type: int | |
| NamedType | |
| name: List @174 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @178 | |
| arguments | |
| NamedType | |
| name: String @179 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @185 | |
| element: dart:core::@class::List | |
| type: List<String> | |
| rightBracket: > @186 | |
| leftBracket: { @187 | |
| rightBracket: } @188 | |
| isMap: true | |
| staticType: Map<int, List<String>> | |
| inducedGetter: #F8 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vDynamic1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vDynamic1 | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vDynamic2 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:48) | |
| element: <testLibrary>::@getter::vDynamic2 | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vInterface (nameOffset:<null>) (firstTokenOffset:<null>) (offset:90) | |
| element: <testLibrary>::@getter::vInterface | |
| inducingVariable: #F5 | |
| #F8 isComplete isOriginVariable isStatic vInterfaceWithTypeArguments (nameOffset:<null>) (firstTokenOffset:<null>) (offset:132) | |
| element: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| inducingVariable: #F7 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDynamic1 | |
| reference: <testLibrary>::@topLevelVariable::vDynamic1 | |
| firstFragment: #F1 | |
| type: Map<dynamic, int> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vDynamic1 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDynamic2 | |
| reference: <testLibrary>::@topLevelVariable::vDynamic2 | |
| firstFragment: #F3 | |
| type: Map<int, dynamic> | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vDynamic2 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterface | |
| reference: <testLibrary>::@topLevelVariable::vInterface | |
| firstFragment: #F5 | |
| type: Map<int, String> | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vInterface | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| firstFragment: #F7 | |
| type: Map<int, List<String>> | |
| constantInitializer | |
| fragment: #F7 | |
| expression: expression_3 | |
| getter: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| getters | |
| isOriginVariable isStatic vDynamic1 | |
| reference: <testLibrary>::@getter::vDynamic1 | |
| firstFragment: #F2 | |
| returnType: Map<dynamic, int> | |
| variable: <testLibrary>::@topLevelVariable::vDynamic1 | |
| isOriginVariable isStatic vDynamic2 | |
| reference: <testLibrary>::@getter::vDynamic2 | |
| firstFragment: #F4 | |
| returnType: Map<int, dynamic> | |
| variable: <testLibrary>::@topLevelVariable::vDynamic2 | |
| isOriginVariable isStatic vInterface | |
| reference: <testLibrary>::@getter::vInterface | |
| firstFragment: #F6 | |
| returnType: Map<int, String> | |
| variable: <testLibrary>::@topLevelVariable::vInterface | |
| isOriginVariable isStatic vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| firstFragment: #F8 | |
| returnType: Map<int, List<String>> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| '''); | |
| } | |
| test_const_topLevel_typedSet() async { | |
| var library = await buildLibrary(r''' | |
| const vDynamic1 = const <dynamic>{}; | |
| const vInterface = const <int>{}; | |
| const vInterfaceWithTypeArguments = const <List<String>>{}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vDynamic1 (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::vDynamic1 | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @18 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @24 | |
| arguments | |
| NamedType | |
| name: dynamic @25 | |
| element: dynamic | |
| type: dynamic | |
| rightBracket: > @32 | |
| leftBracket: { @33 | |
| rightBracket: } @34 | |
| isMap: false | |
| staticType: Set<dynamic> | |
| inducedGetter: #F2 | |
| #F3 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterface (nameOffset:43) (firstTokenOffset:43) (offset:43) | |
| element: <testLibrary>::@topLevelVariable::vInterface | |
| initializer: expression_1 | |
| SetOrMapLiteral | |
| constKeyword: const @56 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @62 | |
| arguments | |
| NamedType | |
| name: int @63 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @66 | |
| leftBracket: { @67 | |
| rightBracket: } @68 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F4 | |
| #F5 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic vInterfaceWithTypeArguments (nameOffset:77) (firstTokenOffset:77) (offset:77) | |
| element: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| initializer: expression_2 | |
| SetOrMapLiteral | |
| constKeyword: const @107 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @113 | |
| arguments | |
| NamedType | |
| name: List @114 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @118 | |
| arguments | |
| NamedType | |
| name: String @119 | |
| element: dart:core::@class::String | |
| type: String | |
| rightBracket: > @125 | |
| element: dart:core::@class::List | |
| type: List<String> | |
| rightBracket: > @126 | |
| leftBracket: { @127 | |
| rightBracket: } @128 | |
| isMap: false | |
| staticType: Set<List<String>> | |
| inducedGetter: #F6 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic vDynamic1 (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::vDynamic1 | |
| inducingVariable: #F1 | |
| #F4 isComplete isOriginVariable isStatic vInterface (nameOffset:<null>) (firstTokenOffset:<null>) (offset:43) | |
| element: <testLibrary>::@getter::vInterface | |
| inducingVariable: #F3 | |
| #F6 isComplete isOriginVariable isStatic vInterfaceWithTypeArguments (nameOffset:<null>) (firstTokenOffset:<null>) (offset:77) | |
| element: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| inducingVariable: #F5 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vDynamic1 | |
| reference: <testLibrary>::@topLevelVariable::vDynamic1 | |
| firstFragment: #F1 | |
| type: Set<dynamic> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::vDynamic1 | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterface | |
| reference: <testLibrary>::@topLevelVariable::vInterface | |
| firstFragment: #F3 | |
| type: Set<int> | |
| constantInitializer | |
| fragment: #F3 | |
| expression: expression_1 | |
| getter: <testLibrary>::@getter::vInterface | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| firstFragment: #F5 | |
| type: Set<List<String>> | |
| constantInitializer | |
| fragment: #F5 | |
| expression: expression_2 | |
| getter: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| getters | |
| isOriginVariable isStatic vDynamic1 | |
| reference: <testLibrary>::@getter::vDynamic1 | |
| firstFragment: #F2 | |
| returnType: Set<dynamic> | |
| variable: <testLibrary>::@topLevelVariable::vDynamic1 | |
| isOriginVariable isStatic vInterface | |
| reference: <testLibrary>::@getter::vInterface | |
| firstFragment: #F4 | |
| returnType: Set<int> | |
| variable: <testLibrary>::@topLevelVariable::vInterface | |
| isOriginVariable isStatic vInterfaceWithTypeArguments | |
| reference: <testLibrary>::@getter::vInterfaceWithTypeArguments | |
| firstFragment: #F6 | |
| returnType: Set<List<String>> | |
| variable: <testLibrary>::@topLevelVariable::vInterfaceWithTypeArguments | |
| '''); | |
| } | |
| test_const_topLevel_untypedList() async { | |
| var library = await buildLibrary(r''' | |
| const v = const [1, 2, 3]; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| ListLiteral | |
| constKeyword: const @10 | |
| leftBracket: [ @16 | |
| elements2 | |
| IntegerLiteral | |
| literal: 1 @17 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 2 @20 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 3 @23 | |
| staticType: int | |
| rightBracket: ] @24 | |
| staticType: List<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: List<int> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: List<int> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_topLevel_untypedMap() async { | |
| var library = await buildLibrary(r''' | |
| const v = const {0: 'aaa', 1: 'bbb', 2: 'ccc'}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @10 | |
| leftBracket: { @16 | |
| elements2 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 0 @17 | |
| staticType: int | |
| separator: : @18 | |
| value2: SimpleStringLiteral | |
| literal: 'aaa' @20 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 1 @27 | |
| staticType: int | |
| separator: : @28 | |
| value2: SimpleStringLiteral | |
| literal: 'bbb' @30 | |
| MapLiteralEntry | |
| key2: IntegerLiteral | |
| literal: 2 @37 | |
| staticType: int | |
| separator: : @38 | |
| value2: SimpleStringLiteral | |
| literal: 'ccc' @40 | |
| rightBracket: } @45 | |
| isMap: true | |
| staticType: Map<int, String> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: Map<int, String> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: Map<int, String> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_topLevel_untypedSet() async { | |
| var library = await buildLibrary(r''' | |
| const v = const {0, 1, 2}; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| SetOrMapLiteral | |
| constKeyword: const @10 | |
| leftBracket: { @16 | |
| elements2 | |
| IntegerLiteral | |
| literal: 0 @17 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 1 @20 | |
| staticType: int | |
| IntegerLiteral | |
| literal: 2 @23 | |
| staticType: int | |
| rightBracket: } @24 | |
| isMap: false | |
| staticType: Set<int> | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: Set<int> | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: Set<int> | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_const_typeLiteral() async { | |
| var library = await buildLibrary(r''' | |
| const v = List<int>; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| topLevelVariables | |
| #F1 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic v (nameOffset:6) (firstTokenOffset:6) (offset:6) | |
| element: <testLibrary>::@topLevelVariable::v | |
| initializer: expression_0 | |
| TypeLiteral | |
| type: NamedType | |
| name: List @10 | |
| typeArguments: TypeArgumentList | |
| leftBracket: < @14 | |
| arguments | |
| NamedType | |
| name: int @15 | |
| element: dart:core::@class::int | |
| type: int | |
| rightBracket: > @18 | |
| element: dart:core::@class::List | |
| type: List<int> | |
| staticType: Type | |
| inducedGetter: #F2 | |
| getters | |
| #F2 isComplete isOriginVariable isStatic v (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@getter::v | |
| inducingVariable: #F1 | |
| topLevelVariables | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer v | |
| reference: <testLibrary>::@topLevelVariable::v | |
| firstFragment: #F1 | |
| type: Type | |
| constantInitializer | |
| fragment: #F1 | |
| expression: expression_0 | |
| getter: <testLibrary>::@getter::v | |
| getters | |
| isOriginVariable isStatic v | |
| reference: <testLibrary>::@getter::v | |
| firstFragment: #F2 | |
| returnType: Type | |
| variable: <testLibrary>::@topLevelVariable::v | |
| '''); | |
| } | |
| test_constExpr_pushReference_enum_field() async { | |
| var library = await buildLibrary(r''' | |
| enum E { a, b, c } | |
| final vValue = E.a; | |
| final vValues = E.values; | |
| final vIndex = E.a.index; | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| enums | |
| #F1 enum E (nameOffset:5) (firstTokenOffset:0) (offset:5) | |
| element: <testLibrary>::@enum::E | |
| fields | |
| #F2 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic a (nameOffset:9) (firstTokenOffset:9) (offset:9) | |
| element: <testLibrary>::@enum::E::@field::a | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F3 | |
| #F4 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic b (nameOffset:12) (firstTokenOffset:12) (offset:12) | |
| element: <testLibrary>::@enum::E::@field::b | |
| initializer: expression_1 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F5 | |
| #F6 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic c (nameOffset:15) (firstTokenOffset:15) (offset:15) | |
| element: <testLibrary>::@enum::E::@field::c | |
| initializer: expression_2 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F7 | |
| #F8 isConst isOriginEnumValues isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@field::values | |
| initializer: expression_3 | |
| ListLiteral | |
| leftBracket: [ @0 | |
| elements2 | |
| UnqualifiedNameExpression | |
| name: a @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::a | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| UnqualifiedNameExpression | |
| name: b @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::b | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| UnqualifiedNameExpression | |
| name: c @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::c | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| elements(v1) | |
| SimpleIdentifier | |
| token: a @-1 | |
| element: <testLibrary>::@enum::E::@getter::a | |
| staticType: E | |
| SimpleIdentifier | |
| token: b @-1 | |
| element: <testLibrary>::@enum::E::@getter::b | |
| staticType: E | |
| SimpleIdentifier | |
| token: c @-1 | |
| element: <testLibrary>::@enum::E::@getter::c | |
| staticType: E | |
| rightBracket: ] @0 | |
| staticType: List<E> | |
| inducedGetter: #F9 | |
| constructors | |
| #F10 isConst isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| typeName: E | |
| getters | |
| #F3 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:9) | |
| element: <testLibrary>::@enum::E::@getter::a | |
| inducingVariable: #F2 | |
| #F5 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:12) | |
| element: <testLibrary>::@enum::E::@getter::b | |
| inducingVariable: #F4 | |
| #F7 isComplete isOriginVariable isStatic c (nameOffset:<null>) (firstTokenOffset:<null>) (offset:15) | |
| element: <testLibrary>::@enum::E::@getter::c | |
| inducingVariable: #F6 | |
| #F9 isComplete isOriginVariable isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@getter::values | |
| inducingVariable: #F8 | |
| topLevelVariables | |
| #F11 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic vValue (nameOffset:26) (firstTokenOffset:26) (offset:26) | |
| element: <testLibrary>::@topLevelVariable::vValue | |
| inducedGetter: #F12 | |
| #F13 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic vValues (nameOffset:46) (firstTokenOffset:46) (offset:46) | |
| element: <testLibrary>::@topLevelVariable::vValues | |
| inducedGetter: #F14 | |
| #F15 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic vIndex (nameOffset:72) (firstTokenOffset:72) (offset:72) | |
| element: <testLibrary>::@topLevelVariable::vIndex | |
| inducedGetter: #F16 | |
| getters | |
| #F12 isComplete isOriginVariable isStatic vValue (nameOffset:<null>) (firstTokenOffset:<null>) (offset:26) | |
| element: <testLibrary>::@getter::vValue | |
| inducingVariable: #F11 | |
| #F14 isComplete isOriginVariable isStatic vValues (nameOffset:<null>) (firstTokenOffset:<null>) (offset:46) | |
| element: <testLibrary>::@getter::vValues | |
| inducingVariable: #F13 | |
| #F16 isComplete isOriginVariable isStatic vIndex (nameOffset:<null>) (firstTokenOffset:<null>) (offset:72) | |
| element: <testLibrary>::@getter::vIndex | |
| inducingVariable: #F15 | |
| enums | |
| isSimplyBounded enum E | |
| reference: <testLibrary>::@enum::E | |
| firstFragment: #F1 | |
| supertype: Enum | |
| fields | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@enum::E::@field::a | |
| firstFragment: #F2 | |
| type: E | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@enum::E::@getter::a | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@enum::E::@field::b | |
| firstFragment: #F4 | |
| type: E | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_1 | |
| getter: <testLibrary>::@enum::E::@getter::b | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer c | |
| reference: <testLibrary>::@enum::E::@field::c | |
| firstFragment: #F6 | |
| type: E | |
| constantInitializer | |
| fragment: #F6 | |
| expression: expression_2 | |
| getter: <testLibrary>::@enum::E::@getter::c | |
| isConst isOriginEnumValues isStatic values | |
| reference: <testLibrary>::@enum::E::@field::values | |
| firstFragment: #F8 | |
| type: List<E> | |
| constantInitializer | |
| fragment: #F8 | |
| expression: expression_3 | |
| getter: <testLibrary>::@enum::E::@getter::values | |
| constructors | |
| isConst isOriginImplicitDefault new | |
| reference: <testLibrary>::@enum::E::@constructor::new | |
| firstFragment: #F10 | |
| superConstructor: dart:core::@class::Enum::@constructor::new | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@enum::E::@getter::a | |
| firstFragment: #F3 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@enum::E::@getter::b | |
| firstFragment: #F5 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::b | |
| isOriginVariable isStatic c | |
| reference: <testLibrary>::@enum::E::@getter::c | |
| firstFragment: #F7 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::c | |
| isOriginVariable isStatic values | |
| reference: <testLibrary>::@enum::E::@getter::values | |
| firstFragment: #F9 | |
| returnType: List<E> | |
| variable: <testLibrary>::@enum::E::@field::values | |
| topLevelVariables | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer vValue | |
| reference: <testLibrary>::@topLevelVariable::vValue | |
| firstFragment: #F11 | |
| type: E | |
| getter: <testLibrary>::@getter::vValue | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer vValues | |
| reference: <testLibrary>::@topLevelVariable::vValues | |
| firstFragment: #F13 | |
| type: List<E> | |
| getter: <testLibrary>::@getter::vValues | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer vIndex | |
| reference: <testLibrary>::@topLevelVariable::vIndex | |
| firstFragment: #F15 | |
| type: int | |
| getter: <testLibrary>::@getter::vIndex | |
| getters | |
| isOriginVariable isStatic vValue | |
| reference: <testLibrary>::@getter::vValue | |
| firstFragment: #F12 | |
| returnType: E | |
| variable: <testLibrary>::@topLevelVariable::vValue | |
| isOriginVariable isStatic vValues | |
| reference: <testLibrary>::@getter::vValues | |
| firstFragment: #F14 | |
| returnType: List<E> | |
| variable: <testLibrary>::@topLevelVariable::vValues | |
| isOriginVariable isStatic vIndex | |
| reference: <testLibrary>::@getter::vIndex | |
| firstFragment: #F16 | |
| returnType: int | |
| variable: <testLibrary>::@topLevelVariable::vIndex | |
| '''); | |
| } | |
| test_constExpr_pushReference_enum_method() async { | |
| var library = await buildLibrary(r''' | |
| enum E { a } | |
| final vToString = E.a.toString(); | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| enums | |
| #F1 enum E (nameOffset:5) (firstTokenOffset:0) (offset:5) | |
| element: <testLibrary>::@enum::E | |
| fields | |
| #F2 hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic a (nameOffset:9) (firstTokenOffset:9) (offset:9) | |
| element: <testLibrary>::@enum::E::@field::a | |
| initializer: expression_0 | |
| ConstructorInvocation | |
| constructorReference: ConstructorReference2 | |
| typeReference: ConstructorTypeReference | |
| name: E @-1 | |
| element: <testLibrary>::@enum::E | |
| type: E | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| argumentList: ArgumentList | |
| leftParenthesis: ( @0 | |
| rightParenthesis: ) @0 | |
| staticType: E | |
| inducedGetter: #F3 | |
| #F4 isConst isOriginEnumValues isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@field::values | |
| initializer: expression_1 | |
| ListLiteral | |
| leftBracket: [ @0 | |
| elements2 | |
| UnqualifiedNameExpression | |
| name: a @-1 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@enum::E::@getter::a | |
| invokeType: E Function() | |
| type: E | |
| staticType: E | |
| elements(v1) | |
| SimpleIdentifier | |
| token: a @-1 | |
| element: <testLibrary>::@enum::E::@getter::a | |
| staticType: E | |
| rightBracket: ] @0 | |
| staticType: List<E> | |
| inducedGetter: #F5 | |
| constructors | |
| #F6 isConst isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@constructor::new | |
| typeName: E | |
| getters | |
| #F3 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:9) | |
| element: <testLibrary>::@enum::E::@getter::a | |
| inducingVariable: #F2 | |
| #F5 isComplete isOriginVariable isStatic values (nameOffset:<null>) (firstTokenOffset:<null>) (offset:5) | |
| element: <testLibrary>::@enum::E::@getter::values | |
| inducingVariable: #F4 | |
| topLevelVariables | |
| #F7 hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic vToString (nameOffset:20) (firstTokenOffset:20) (offset:20) | |
| element: <testLibrary>::@topLevelVariable::vToString | |
| inducedGetter: #F8 | |
| getters | |
| #F8 isComplete isOriginVariable isStatic vToString (nameOffset:<null>) (firstTokenOffset:<null>) (offset:20) | |
| element: <testLibrary>::@getter::vToString | |
| inducingVariable: #F7 | |
| enums | |
| isSimplyBounded enum E | |
| reference: <testLibrary>::@enum::E | |
| firstFragment: #F1 | |
| supertype: Enum | |
| fields | |
| hasImplicitType hasInitializer isConst isEnumConstant isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@enum::E::@field::a | |
| firstFragment: #F2 | |
| type: E | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@enum::E::@getter::a | |
| isConst isOriginEnumValues isStatic values | |
| reference: <testLibrary>::@enum::E::@field::values | |
| firstFragment: #F4 | |
| type: List<E> | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_1 | |
| getter: <testLibrary>::@enum::E::@getter::values | |
| constructors | |
| isConst isOriginImplicitDefault new | |
| reference: <testLibrary>::@enum::E::@constructor::new | |
| firstFragment: #F6 | |
| superConstructor: dart:core::@class::Enum::@constructor::new | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@enum::E::@getter::a | |
| firstFragment: #F3 | |
| returnType: E | |
| variable: <testLibrary>::@enum::E::@field::a | |
| isOriginVariable isStatic values | |
| reference: <testLibrary>::@enum::E::@getter::values | |
| firstFragment: #F5 | |
| returnType: List<E> | |
| variable: <testLibrary>::@enum::E::@field::values | |
| topLevelVariables | |
| hasImplicitType hasInitializer isFinal isOriginDeclaration isStatic isTypeInferredFromInitializer vToString | |
| reference: <testLibrary>::@topLevelVariable::vToString | |
| firstFragment: #F7 | |
| type: String | |
| getter: <testLibrary>::@getter::vToString | |
| getters | |
| isOriginVariable isStatic vToString | |
| reference: <testLibrary>::@getter::vToString | |
| firstFragment: #F8 | |
| returnType: String | |
| variable: <testLibrary>::@topLevelVariable::vToString | |
| '''); | |
| } | |
| test_constExpr_pushReference_field_simpleIdentifier() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const a = b; | |
| static const b = null; | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:25) (firstTokenOffset:25) (offset:25) | |
| element: <testLibrary>::@class::C::@field::a | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: b @29 | |
| resolution: GetterInvocationResolution | |
| element: <testLibrary>::@class::C::@getter::b | |
| invokeType: dynamic Function() | |
| type: dynamic | |
| staticType: dynamic | |
| inducedGetter: #F3 | |
| #F4 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic b (nameOffset:47) (firstTokenOffset:47) (offset:47) | |
| element: <testLibrary>::@class::C::@field::b | |
| initializer: expression_1 | |
| NullLiteral | |
| literal: null @51 | |
| staticType: Null | |
| inducedGetter: #F5 | |
| constructors | |
| #F6 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25) | |
| element: <testLibrary>::@class::C::@getter::a | |
| inducingVariable: #F2 | |
| #F5 isComplete isOriginVariable isStatic b (nameOffset:<null>) (firstTokenOffset:<null>) (offset:47) | |
| element: <testLibrary>::@class::C::@getter::b | |
| inducingVariable: #F4 | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@class::C::@field::a | |
| firstFragment: #F2 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::a | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer b | |
| reference: <testLibrary>::@class::C::@field::b | |
| firstFragment: #F4 | |
| type: dynamic | |
| constantInitializer | |
| fragment: #F4 | |
| expression: expression_1 | |
| getter: <testLibrary>::@class::C::@getter::b | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F6 | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@class::C::@getter::a | |
| firstFragment: #F3 | |
| returnType: dynamic | |
| variable: <testLibrary>::@class::C::@field::a | |
| isOriginVariable isStatic b | |
| reference: <testLibrary>::@class::C::@getter::b | |
| firstFragment: #F5 | |
| returnType: dynamic | |
| variable: <testLibrary>::@class::C::@field::b | |
| '''); | |
| } | |
| test_constExpr_pushReference_staticMethod_simpleIdentifier() async { | |
| var library = await buildLibrary(r''' | |
| class C { | |
| static const a = m; | |
| static m() {} | |
| } | |
| '''); | |
| checkElementText(library, r''' | |
| library | |
| reference: <testLibrary> | |
| fragments | |
| #F0 <testLibraryFragment> | |
| element: <testLibrary> | |
| classes | |
| #F1 class C (nameOffset:6) (firstTokenOffset:0) (offset:6) | |
| element: <testLibrary>::@class::C | |
| fields | |
| #F2 hasImplicitType hasInitializer isConst isOriginDeclaration isStatic a (nameOffset:25) (firstTokenOffset:25) (offset:25) | |
| element: <testLibrary>::@class::C::@field::a | |
| initializer: expression_0 | |
| UnqualifiedNameExpression | |
| name: m @29 | |
| resolution: ExecutableTearOffResolution | |
| element: <testLibrary>::@class::C::@method::m | |
| type: dynamic Function() | |
| staticType: dynamic Function() | |
| inducedGetter: #F3 | |
| constructors | |
| #F4 isOriginImplicitDefault new (nameOffset:<null>) (firstTokenOffset:<null>) (offset:6) | |
| element: <testLibrary>::@class::C::@constructor::new | |
| typeName: C | |
| getters | |
| #F3 isComplete isOriginVariable isStatic a (nameOffset:<null>) (firstTokenOffset:<null>) (offset:25) | |
| element: <testLibrary>::@class::C::@getter::a | |
| inducingVariable: #F2 | |
| methods | |
| #F5 hasImplicitReturnType isComplete isOriginDeclaration isStatic m (nameOffset:41) (firstTokenOffset:34) (offset:41) | |
| element: <testLibrary>::@class::C::@method::m | |
| classes | |
| isSimplyBounded class C | |
| reference: <testLibrary>::@class::C | |
| firstFragment: #F1 | |
| fields | |
| hasImplicitType hasInitializer isConst isOriginDeclaration isStatic isTypeInferredFromInitializer a | |
| reference: <testLibrary>::@class::C::@field::a | |
| firstFragment: #F2 | |
| type: dynamic Function() | |
| constantInitializer | |
| fragment: #F2 | |
| expression: expression_0 | |
| getter: <testLibrary>::@class::C::@getter::a | |
| constructors | |
| isOriginImplicitDefault new | |
| reference: <testLibrary>::@class::C::@constructor::new | |
| firstFragment: #F4 | |
| getters | |
| isOriginVariable isStatic a | |
| reference: <testLibrary>::@class::C::@getter::a | |
| firstFragment: #F3 | |
| returnType: dynamic Function() | |
| variable: <testLibrary>::@class::C::@field::a | |
| methods | |
| hasImplicitReturnType isOriginDeclaration isStatic m | |
| reference: <testLibrary>::@class::C::@method::m | |
| firstFragment: #F5 | |
| returnType: dynamic | |
| '''); | |
| } | |
| // TODO(scheglov): This is duplicate. | |
| void _assertTypeStr(DartType type, String expected) { | |
| var typeStr = type.getDisplayString(); | |
| expect(typeStr, expected); | |
| } | |
| } | |
| @reflectiveTest | |
| class ConstElementTest_fromBytes extends ConstElementTest { | |
| @override | |
| bool get keepLinkingLibraries => false; | |
| } | |
| @reflectiveTest | |
| class ConstElementTest_keepLinking extends ConstElementTest { | |
| @override | |
| bool get keepLinkingLibraries => true; | |
| } |