Skip to content

Commit 4b59bf5

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Fix bug introduced in refactoring.
A constant was renamed to conform to the style guide, and that made it have the same name as a local variable, and it was shadowed inside that function. Rename another constant while we're here. Fixes #45432. Bug: http://dartbug.com/45432 Change-Id: Ie7e83bb77fea25a93a006bde78431ec35007a82a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/192920 Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]>
1 parent 5f57456 commit 4b59bf5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

sdk/lib/_internal/vm/lib/convert_patch.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,10 @@ class _ReviverJsonListener extends _BuildJsonListener {
231231
* These are all ASCII, so an [Uint8List] is used as backing store.
232232
*
233233
* This buffer is used when a JSON number is split between separate chunks.
234-
*
235234
*/
236235
class _NumberBuffer {
237236
static const int minCapacity = 16;
238-
static const int kDefaultOverhead = 5;
237+
static const int defaultOverhead = 5;
239238
Uint8List list;
240239
int length = 0;
241240
_NumberBuffer(int initialCapacity)
@@ -246,12 +245,14 @@ class _NumberBuffer {
246245
// Pick an initial capacity greater than the first part's size.
247246
// The typical use case has two parts, this is the attempt at
248247
// guessing the size of the second part without overdoing it.
249-
// The default estimate of the second part is [kDefaultOverhead],
248+
// The default estimate of the second part is [defaultOverhead],
250249
// then round to multiplum of four, and return the result,
251250
// or [minCapacity] if that is greater.
252251
static int _initialCapacity(int minCapacity) {
253-
minCapacity += kDefaultOverhead;
254-
if (minCapacity < minCapacity) return minCapacity;
252+
minCapacity += defaultOverhead;
253+
if (minCapacity < _NumberBuffer.minCapacity) {
254+
return _NumberBuffer.minCapacity;
255+
}
255256
minCapacity = (minCapacity + 3) & ~3; // Round to multiple of four.
256257
return minCapacity;
257258
}
@@ -1214,7 +1215,7 @@ abstract class _ChunkedJsonParser<T> {
12141215
// Continues an already chunked number across an entire chunk.
12151216
int continueChunkNumber(int state, int start, _NumberBuffer buffer) {
12161217
int end = chunkEnd;
1217-
addNumberChunk(buffer, start, end, _NumberBuffer.kDefaultOverhead);
1218+
addNumberChunk(buffer, start, end, _NumberBuffer.defaultOverhead);
12181219
this.buffer = buffer;
12191220
this.partialState = PARTIAL_NUMERAL | state;
12201221
return end;

0 commit comments

Comments
 (0)