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

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

Issue 2779993002: Store literal values and invocations arguments only for constants and untyped literals. (Closed)
Patch Set: Update IDL documentation. Created 3 years, 9 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
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 909e0b558947a0a820f9033b6562b54177e2dc10..a765d6c1cdbd735790d7de999276d61b1c28e15d 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -7099,9 +7099,6 @@ final v = new C().f;
}
test_expr_functionExpression_asArgument() {
- if (skipNonConstInitializers) {
- return;
- }
UnlinkedVariable variable = serializeVariableText('''
final v = foo(5, () => 42);
foo(a, b) {}
@@ -7109,16 +7106,11 @@ foo(a, b) {}
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
- UnlinkedExprOperation.pushInt,
- UnlinkedExprOperation.pushLocalFunctionReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
- 5,
- 0,
0,
0,
- 2,
0
],
referenceValidators: [
@@ -7128,9 +7120,6 @@ foo(a, b) {}
}
test_expr_functionExpression_asArgument_multiple() {
- if (skipNonConstInitializers) {
- return;
- }
UnlinkedVariable variable = serializeVariableText('''
final v = foo(5, () => 42, () => 43);
foo(a, b, c) {}
@@ -7138,19 +7127,11 @@ foo(a, b, c) {}
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
- UnlinkedExprOperation.pushInt,
- UnlinkedExprOperation.pushLocalFunctionReference,
- UnlinkedExprOperation.pushLocalFunctionReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
- 5,
- 0,
0,
0,
- 1,
- 0,
- 3,
0
],
referenceValidators: [
@@ -7412,9 +7393,6 @@ class C<T> {
}
test_expr_invokeMethod_instance() {
- if (skipNonConstInitializers) {
- return;
- }
UnlinkedVariable variable = serializeVariableText('''
class C {
int m(a, {b, c}) => 42;
@@ -7425,24 +7403,16 @@ final v = new C().m(1, b: 2, c: 3);
isValidConst: false,
operators: [
UnlinkedExprOperation.invokeConstructor,
- UnlinkedExprOperation.pushInt,
- UnlinkedExprOperation.pushInt,
- UnlinkedExprOperation.pushInt,
UnlinkedExprOperation.invokeMethod,
],
ints: [
0,
0,
- 1,
- 2,
- 3,
- 2,
- 1,
+ 0,
+ 0,
0
],
strings: [
- 'b',
- 'c',
'm'
],
referenceValidators: [
@@ -7504,15 +7474,11 @@ final v = a.b.c.m(10, 20);
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
- UnlinkedExprOperation.pushInt,
- UnlinkedExprOperation.pushInt,
UnlinkedExprOperation.invokeMethodRef,
],
ints: [
- 10,
- 20,
0,
- 2,
+ 0,
0
],
strings: [],
@@ -7577,17 +7543,14 @@ final v = f(u);
assertUnlinkedConst(variable.initializer.bodyExpr,
isValidConst: false,
operators: [
- UnlinkedExprOperation.pushReference,
UnlinkedExprOperation.invokeMethodRef
],
ints: [
0,
- 1,
+ 0,
0
],
referenceValidators: [
- (EntityRef r) => checkTypeRef(r, null, 'u',
- expectedKind: ReferenceKind.topLevelPropertyAccessor),
(EntityRef r) => checkTypeRef(r, null, 'f',
expectedKind: ReferenceKind.topLevelFunction)
]);
@@ -7620,6 +7583,72 @@ final v = f<int, String>();
]);
}
+ test_expr_makeTypedList() {
+ UnlinkedVariable variable =
+ serializeVariableText('var v = <int>[11, 22, 33];');
+ assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedExprOperation.makeTypedList
+ ], ints: [
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'int',
+ expectedKind: ReferenceKind.classOrEnum)
+ ]);
+ }
+
+ test_expr_makeTypedMap() {
+ UnlinkedVariable variable = serializeVariableText(
+ 'var v = <int, String>{11: "aaa", 22: "bbb", 33: "ccc"};');
+ assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedExprOperation.makeTypedMap
+ ], ints: [
+ 0
+ ], referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'int',
+ expectedKind: ReferenceKind.classOrEnum),
+ (EntityRef r) => checkTypeRef(r, 'dart:core', 'String',
+ expectedKind: ReferenceKind.classOrEnum)
+ ]);
+ }
+
+ test_expr_makeUntypedList() {
+ UnlinkedVariable variable = serializeVariableText('var v = [11, 22, 33];');
+ assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.makeUntypedList
+ ], ints: [
+ 11,
+ 22,
+ 33,
+ 3
+ ]);
+ }
+
+ test_expr_makeUntypedMap() {
+ UnlinkedVariable variable =
+ serializeVariableText('var v = {11: "aaa", 22: "bbb", 33: "ccc"};');
+ assertUnlinkedConst(variable.initializer.bodyExpr, operators: [
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushString,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushString,
+ UnlinkedExprOperation.pushInt,
+ UnlinkedExprOperation.pushString,
+ UnlinkedExprOperation.makeUntypedMap
+ ], ints: [
+ 11,
+ 22,
+ 33,
+ 3
+ ], strings: [
+ 'aaa',
+ 'bbb',
+ 'ccc'
+ ]);
+ }
+
test_expr_super() {
if (skipNonConstInitializers) {
return;

Powered by Google App Engine
This is Rietveld 408576698