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

Unified Diff: runtime/bin/buffer_list.dart

Issue 11273041: Make first and last getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status files with co19 issue number. Created 8 years, 2 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
« no previous file with comments | « pkg/unittest/mock.dart ('k') | runtime/bin/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/buffer_list.dart
diff --git a/runtime/bin/buffer_list.dart b/runtime/bin/buffer_list.dart
index c8e98e908252a7e220474611ba1a80c7325b709b..0dab719a318985298912c829be6da16c674c17c3 100644
--- a/runtime/bin/buffer_list.dart
+++ b/runtime/bin/buffer_list.dart
@@ -28,7 +28,7 @@ class _BufferList {
* buffer and does not remove the buffer from the list. Use
* [index] to determine the index of the first byte in the buffer.
*/
- List<int> get first => _buffers.first();
+ List<int> get first => _buffers.first;
/**
* Returns the current index of the next byte. This will always be
@@ -40,15 +40,15 @@ class _BufferList {
/**
* Peek at the next available byte.
*/
- int peek() => _buffers.first()[_index];
+ int peek() => _buffers.first[_index];
/**
* Returns the next available byte removing it from the buffers.
*/
int next() {
- int value = _buffers.first()[_index++];
+ int value = _buffers.first[_index++];
_length--;
- if (_index == _buffers.first().length) {
+ if (_index == _buffers.first.length) {
_buffers.removeFirst();
_index = 0;
}
@@ -62,19 +62,19 @@ class _BufferList {
List<int> readBytes(int count) {
List<int> result;
if (_length == 0 || _length < count) return null;
- if (_index == 0 && _buffers.first().length == count) {
- result = _buffers.first();
+ if (_index == 0 && _buffers.first.length == count) {
+ result = _buffers.first;
_buffers.removeFirst();
_index = 0;
_length -= count;
return result;
} else {
- int firstRemaining = _buffers.first().length - _index;
+ int firstRemaining = _buffers.first.length - _index;
if (firstRemaining >= count) {
- result = _buffers.first().getRange(_index, count);
+ result = _buffers.first.getRange(_index, count);
_index += count;
_length -= count;
- if (_index == _buffers.first().length) {
+ if (_index == _buffers.first.length) {
_buffers.removeFirst();
_index = 0;
}
@@ -83,11 +83,11 @@ class _BufferList {
result = new Uint8List(count);
int remaining = count;
while (remaining > 0) {
- int bytesInFirst = _buffers.first().length - _index;
+ int bytesInFirst = _buffers.first.length - _index;
if (bytesInFirst <= remaining) {
result.setRange(count - remaining,
bytesInFirst,
- _buffers.first(),
+ _buffers.first,
_index);
_buffers.removeFirst();
_index = 0;
@@ -96,12 +96,12 @@ class _BufferList {
} else {
result.setRange(count - remaining,
remaining,
- _buffers.first(),
+ _buffers.first,
_index);
_index = remaining;
_length -= remaining;
remaining = 0;
- assert(_index < _buffers.first().length);
+ assert(_index < _buffers.first.length);
}
}
return result;
« no previous file with comments | « pkg/unittest/mock.dart ('k') | runtime/bin/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698