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

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: 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..730ce28534af703cc5189f472bdf84f62847ea4b 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -865,6 +865,10 @@ class ResynthTest extends ResolverTestCase {
VariableElement resynthesized, VariableElement original, String desc) {
compareElements(resynthesized, original, desc);
compareTypes(resynthesized.type, original.type, desc);
+ if (original is! Member) {
Paul Berry 2016/02/17 21:15:30 Again, why should we skip this code if original is
scheglov 2016/02/17 21:27:51 I've added the explanation comment.
+ compareVariableInitializers(
+ resynthesized.initializer, original.initializer, desc);
+ }
VariableElementImpl originalActual = getActualElement(original, desc);
if (originalActual is ConstVariableElement) {
VariableElementImpl resynthesizedActual =
@@ -881,6 +885,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

Powered by Google App Engine
This is Rietveld 408576698