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

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

Issue 1569633003: Fix resynthesis of variables/fields with implicit types. (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/resynthesize.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/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index f13d981195dcb8a3b1dce7b9e58a93bb1cc2147e..4738af2aad49ae8156c90373025ba2473475be73 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -107,11 +107,15 @@ class ResynthTest extends ResolverTestCase {
for (int i = 0; i < resynthesized.accessors.length; i++) {
String name = original.accessors[i].name;
if (name.endsWith('=')) {
- comparePropertyAccessorElements(resynthesized.getSetter(name),
- original.accessors[i], '$desc.${original.accessors[i].name}=');
+ comparePropertyAccessorElements(
+ resynthesized.getSetter(name),
+ original.accessors[i],
+ '$desc setter ${original.accessors[i].name}');
} else {
- comparePropertyAccessorElements(resynthesized.getGetter(name),
- original.accessors[i], '$desc.${original.accessors[i].name}');
+ comparePropertyAccessorElements(
+ resynthesized.getGetter(name),
+ original.accessors[i],
+ '$desc getter ${original.accessors[i].name}');
}
}
expect(resynthesized.methods.length, original.methods.length);
@@ -135,13 +139,15 @@ class ResynthTest extends ResolverTestCase {
expect(resynthesized.topLevelVariables.length,
original.topLevelVariables.length);
for (int i = 0; i < resynthesized.topLevelVariables.length; i++) {
- compareTopLevelVariableElements(resynthesized.topLevelVariables[i],
- original.topLevelVariables[i], original.topLevelVariables[i].name);
+ compareTopLevelVariableElements(
+ resynthesized.topLevelVariables[i],
+ original.topLevelVariables[i],
+ 'variable ${original.topLevelVariables[i].name}');
}
expect(resynthesized.functions.length, original.functions.length);
for (int i = 0; i < resynthesized.functions.length; i++) {
compareFunctionElements(resynthesized.functions[i], original.functions[i],
- original.functions[i].name);
+ 'function ${original.functions[i].name}');
}
expect(resynthesized.functionTypeAliases.length,
original.functionTypeAliases.length);
@@ -158,8 +164,13 @@ class ResynthTest extends ResolverTestCase {
}
expect(resynthesized.accessors.length, original.accessors.length);
for (int i = 0; i < resynthesized.accessors.length; i++) {
- comparePropertyAccessorElements(resynthesized.accessors[i],
- original.accessors[i], original.accessors[i].name);
+ if (original.accessors[i].isGetter) {
+ comparePropertyAccessorElements(resynthesized.accessors[i],
+ original.accessors[i], 'getter ${original.accessors[i].name}');
+ } else {
+ comparePropertyAccessorElements(resynthesized.accessors[i],
+ original.accessors[i], 'setter ${original.accessors[i].name}');
+ }
}
// TODO(paulberry): test metadata and offsetToElementMap.
}
@@ -603,6 +614,10 @@ class E {
checkLibrary('class C { static const int i = 0; }');
}
+ test_class_field_implicit_type() {
+ checkLibrary('class C { var x; }');
+ }
+
test_class_field_static() {
checkLibrary('class C { static int i; }');
}
@@ -615,6 +630,10 @@ class E {
checkLibrary('class C { external int get x; }');
}
+ test_class_getter_implicit_return_type() {
+ checkLibrary('class C { get x => null; }');
+ }
+
test_class_getter_static() {
checkLibrary('class C { static int get x => null; }');
}
@@ -659,6 +678,14 @@ class E {
checkLibrary('class C { external void set x(int value); }');
}
+ test_class_setter_implicit_param_type() {
+ checkLibrary('class C { void set x(value) {} }');
+ }
+
+ test_class_setter_implicit_return_type() {
+ checkLibrary('class C { set x(int value) {} }');
+ }
+
test_class_setter_static() {
checkLibrary('class C { static void set x(int value) {} }');
}
@@ -1081,6 +1108,10 @@ class E {
checkLibrary('const int i = 0;');
}
+ test_variable_implicit_type() {
+ checkLibrary('var x;');
+ }
+
test_variables() {
checkLibrary('int i; int j;');
}
« no previous file with comments | « pkg/analyzer/lib/src/summary/resynthesize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698