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

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

Issue 1579663002: Cache values of fields and lists in summary implementations. (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
Index: pkg/analyzer/test/src/summary/flat_buffers_test.dart
diff --git a/pkg/analyzer/test/src/summary/flat_buffers_test.dart b/pkg/analyzer/test/src/summary/flat_buffers_test.dart
index ec71f29775d63744f2fde2449c6e10a09aea9931..e7b78045b4d8554ea040446cdd30a35b43e5e126 100644
--- a/pkg/analyzer/test/src/summary/flat_buffers_test.dart
+++ b/pkg/analyzer/test/src/summary/flat_buffers_test.dart
@@ -149,8 +149,8 @@ class BuilderTest {
}
// read and verify
BufferPointer root = new BufferPointer.fromBytes(byteList);
- List<TestPointReader> items =
- const ListReader<TestPointReader>(const TestPointReader()).read(root);
+ List<TestPointImpl> items =
+ const ListReader<TestPointImpl>(const TestPointReader()).read(root);
expect(items, hasLength(2));
expect(items[0].x, 10);
expect(items[0].y, 20);
@@ -189,7 +189,7 @@ class BuilderTest {
}
// read and verify
BufferPointer root = new BufferPointer.fromBytes(byteList);
- StringListWrapperReader reader = new StringListWrapperReader().read(root);
+ StringListWrapperImpl reader = new StringListWrapperReader().read(root);
List<String> items = reader.items;
expect(items, hasLength(2));
expect(items, contains('12345'));
@@ -197,35 +197,39 @@ class BuilderTest {
}
}
-class StringListWrapperReader extends TableReader<StringListWrapperReader> {
+class StringListWrapperImpl {
final BufferPointer bp;
- const StringListWrapperReader() : bp = null;
-
- StringListWrapperReader._(this.bp);
+ StringListWrapperImpl(this.bp);
List<String> get items =>
const ListReader<String>(const StringReader()).vTableGet(bp, 0);
+}
+
+class StringListWrapperReader extends TableReader<StringListWrapperImpl> {
+ const StringListWrapperReader();
@override
- StringListWrapperReader createReader(BufferPointer object) {
- return new StringListWrapperReader._(object);
+ StringListWrapperImpl createObject(BufferPointer object) {
+ return new StringListWrapperImpl(object);
}
}
-class TestPointReader extends TableReader<TestPointReader> {
+class TestPointImpl {
final BufferPointer bp;
- const TestPointReader() : bp = null;
-
- TestPointReader._(this.bp);
+ TestPointImpl(this.bp);
int get x => const Int32Reader().vTableGet(bp, 0, 0);
int get y => const Int32Reader().vTableGet(bp, 1, 0);
+}
+
+class TestPointReader extends TableReader<TestPointImpl> {
+ const TestPointReader();
@override
- TestPointReader createReader(BufferPointer object) {
- return new TestPointReader._(object);
+ TestPointImpl createObject(BufferPointer object) {
+ return new TestPointImpl(object);
}
}

Powered by Google App Engine
This is Rietveld 408576698