From fb5884324ac2a9a8ec6a87a6813673e0f4ebf11f Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Mon, 13 Jun 2022 05:04:16 +0000 Subject: [PATCH] Rename methods of CiderByteStore. Change-Id: Ief2d3308f1284a2c0529758beeb6776e3ef8bb8f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247935 Reviewed-by: Brian Wilkerson Commit-Queue: Konstantin Shcheglov --- .../lib/src/dart/micro/cider_byte_store.dart | 16 ++++++++-------- .../lib/src/dart/micro/library_graph.dart | 4 ++-- .../lib/src/dart/micro/resolve_file.dart | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/pkg/analyzer/lib/src/dart/micro/cider_byte_store.dart b/pkg/analyzer/lib/src/dart/micro/cider_byte_store.dart index 92cb27ca735..ea0c573a220 100644 --- a/pkg/analyzer/lib/src/dart/micro/cider_byte_store.dart +++ b/pkg/analyzer/lib/src/dart/micro/cider_byte_store.dart @@ -26,18 +26,18 @@ abstract class CiderByteStore { /// count. /// /// Return `null` if the association does not exist. - Uint8List? get2(String key); + Uint8List? get(String key); /// Associate [bytes] with [key]. /// Return an internalized version of [bytes], the reference count is `1`. /// /// This method will throw an exception if there is already an association - /// for the [key]. The client should either use [get2] to access data, - /// or first [release2] it. - Uint8List putGet2(String key, Uint8List bytes); + /// for the [key]. The client should either use [get] to access data, + /// or first [release] it. + Uint8List putGet(String key, Uint8List bytes); /// Decrement the reference count for every key in [keys]. - void release2(Iterable keys); + void release(Iterable keys); } class CiderByteStoreTestView { @@ -53,7 +53,7 @@ class MemoryCiderByteStore implements CiderByteStore { CiderByteStoreTestView? testView; @override - Uint8List? get2(String key) { + Uint8List? get(String key) { final entry = map[key]; if (entry == null) { return null; @@ -64,7 +64,7 @@ class MemoryCiderByteStore implements CiderByteStore { } @override - Uint8List putGet2(String key, Uint8List bytes) { + Uint8List putGet(String key, Uint8List bytes) { if (map.containsKey(key)) { throw StateError('Overwriting is not allowed: $key'); } @@ -75,7 +75,7 @@ class MemoryCiderByteStore implements CiderByteStore { } @override - void release2(Iterable keys) { + void release(Iterable keys) { for (final key in keys) { final entry = map[key]; if (entry != null) { diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart index 7fe936e5769..f740eb1086e 100644 --- a/pkg/analyzer/lib/src/dart/micro/library_graph.dart +++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart @@ -770,7 +770,7 @@ class _FileStateUnlinked { // TODO(migration): should not be nullable Uint8List? unlinkedBytes; { - unlinkedBytes = location._fsState._byteStore.get2(unlinkedKey); + unlinkedBytes = location._fsState._byteStore.get(unlinkedKey); if (unlinkedBytes == null || unlinkedBytes.isEmpty) { isUnlinkedFromCache = false; @@ -792,7 +792,7 @@ class _FileStateUnlinked { unlinkedBytes = unlinkedUnit.toBytes(); performance.getDataInt('length').add(unlinkedBytes!.length); unlinkedBytes = - location._fsState._byteStore.putGet2(unlinkedKey, unlinkedBytes!); + location._fsState._byteStore.putGet(unlinkedKey, unlinkedBytes!); testData?.unlinkedKeyPut.add(unlinkedKey); }); diff --git a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart index 6e30935df21..ea109b6c6c8 100644 --- a/pkg/analyzer/lib/src/dart/micro/resolve_file.dart +++ b/pkg/analyzer/lib/src/dart/micro/resolve_file.dart @@ -447,12 +447,12 @@ class FileResolver { ); // Release the linked data, the reference count is `>= 1`. - byteStore.release2(linkedKeysToRelease); + byteStore.release(linkedKeysToRelease); } /// Releases from the cache and clear [removedCacheKeys]. void releaseAndClearRemovedIds() { - byteStore.release2(removedCacheKeys); + byteStore.release(removedCacheKeys); removedCacheKeys.clear(); } @@ -903,7 +903,7 @@ class LibraryContext { } var resolutionKey = '${cycle.signatureStr}.resolution'; - var resolutionBytes = byteStore.get2(resolutionKey); + var resolutionBytes = byteStore.get(resolutionKey); var unitsInformativeBytes = {}; for (var library in cycle.libraries) { @@ -976,7 +976,7 @@ class LibraryContext { librariesLinked += cycle.libraries.length; resolutionBytes = linkResult.resolutionBytes; - resolutionBytes = byteStore.putGet2(resolutionKey, resolutionBytes); + resolutionBytes = byteStore.putGet(resolutionKey, resolutionBytes); performance.getDataInt('bytesPut').add(resolutionBytes.length); testData?.forCycle(cycle).putKeys.add(resolutionKey);