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

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

Issue 1707073002: Serialize and resynthesize variable initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fixes for review comments. Created 4 years, 10 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/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 3f6d6536ee097af4b7f4f35e66965121933a6fac..c1f3cbe7672f0eef18211d6e21a22dd191205793 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -865,6 +865,11 @@ class ResynthTest extends ResolverTestCase {
VariableElement resynthesized, VariableElement original, String desc) {
compareElements(resynthesized, original, desc);
compareTypes(resynthesized.type, original.type, desc);
+ // TODO(scheglov) VariableMember.initializer is not implemented
+ if (original is! VariableMember) {
+ compareVariableInitializers(
+ resynthesized.initializer, original.initializer, desc);
+ }
VariableElementImpl originalActual = getActualElement(original, desc);
if (originalActual is ConstVariableElement) {
VariableElementImpl resynthesizedActual =
@@ -881,6 +886,18 @@ class ResynthTest extends ResolverTestCase {
checkPossibleLocalElements(resynthesized, original);
}
+ void compareVariableInitializers(
+ FunctionElement resynthesized, FunctionElement original, String desc) {
+ if (original == null && resynthesized == null) {
+ return;
+ }
+ expect(resynthesized, isNotNull, reason: desc);
+ expect(resynthesized.nameOffset, original.nameOffset, reason: desc);
+ expect(resynthesized.name, original.name, reason: desc);
+ // TODO(scheglov) replace this method with compareFunctionElements()
+ // once we resynthesize initializers return types.
+ }
+
/**
* Serialize the given [library] into a summary. Then create a
* [_TestSummaryResynthesizer] which can deserialize it, along with any
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698