Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(807)

Unified Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 1640813002: Support for static method references in constants. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/summary/summary_common.dart
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 4e98e484f45d3a7f9e41c3a6f43883da4ac78219..2122771dced4b78f94d81b066130038cd481511c 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -2248,6 +2248,72 @@ const v = p.C.F;
]);
}
+ test_constExpr_pushReference_staticMethod() {
+ UnlinkedVariable variable = serializeVariableText('''
+class C {
+ static m() {}
+}
+const v = C.m;
+''');
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.pushReference
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'm',
+ expectedKind: ReferenceKind.staticMethod,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
+ ])
+ ]);
+ }
+
+ test_constExpr_pushReference_staticMethod_imported() {
+ addNamedSource(
+ '/a.dart',
+ '''
+class C {
+ static m() {}
+}
+''');
+ UnlinkedVariable variable = serializeVariableText('''
+import 'a.dart';
+const v = C.m;
+''');
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.pushReference
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm',
+ expectedKind: ReferenceKind.staticMethod,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'C')
+ ])
+ ]);
+ }
+
+ test_constExpr_pushReference_staticMethod_imported_withPrefix() {
+ addNamedSource(
+ '/a.dart',
+ '''
+class C {
+ static m() {}
+}
+''');
+ UnlinkedVariable variable = serializeVariableText('''
+import 'a.dart' as p;
+const v = p.C.m;
+''');
+ _assertUnlinkedConst(variable.constExpr, operators: [
+ UnlinkedConstOperation.pushReference
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, absUri('/a.dart'), 'a.dart', 'm',
+ expectedKind: ReferenceKind.staticMethod,
+ prefixExpectations: [
+ new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
+ new _PrefixExpectation(ReferenceKind.prefix, 'p',
+ inLibraryDefiningUnit: true)
+ ])
+ ]);
+ }
+
test_constExpr_pushReference_topLevelVariable() {
UnlinkedVariable variable = serializeVariableText('''
const int a = 1;
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698