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

Issue 10653002: Fix some warnings in the core library identified by the static analyzer. (Closed)

Created:
8 years, 6 months ago by cshapiro
Modified:
8 years, 6 months ago
Reviewers:
gbracha, siva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix some warnings in the core library identified by the static analyzer. This foray uncovered a latent bug in the byte array view constructor and its use of default arguments. That bug has been corrected and new tests have been added to the test suite. BUG=2136 Committed: https://code.google.com/p/dart/source/detail?r=9013

Patch Set 1 #

Total comments: 10

Patch Set 2 : address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+385 lines, -321 lines) Patch
M corelib/src/future.dart View 1 chunk +1 line, -1 line 0 comments Download
M corelib/src/implementation/collections.dart View 1 chunk +6 lines, -10 lines 0 comments Download
M corelib/src/string_buffer.dart View 1 chunk +1 line, -1 line 0 comments Download
M runtime/lib/byte_array.dart View 1 98 chunks +253 lines, -277 lines 0 comments Download
M runtime/lib/growable_array.dart View 1 chunk +1 line, -1 line 0 comments Download
M runtime/lib/mirrors_impl.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M runtime/lib/string_buffer.dart View 1 chunk +1 line, -1 line 0 comments Download
M runtime/tests/vm/dart/byte_array_test.dart View 1 11 chunks +120 lines, -28 lines 0 comments Download

Messages

Total messages: 5 (0 generated)
cshapiro
8 years, 6 months ago (2012-06-21 21:20:05 UTC) #1
gbracha
lgtm
8 years, 6 months ago (2012-06-21 21:50:18 UTC) #2
siva
lgtm with some comments. http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart File runtime/lib/byte_array.dart (right): http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart#newcode901 runtime/lib/byte_array.dart:901: length * this.bytesPerElement()); why not ...
8 years, 6 months ago (2012-06-21 23:33:08 UTC) #3
cshapiro
http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart File runtime/lib/byte_array.dart (right): http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart#newcode901 runtime/lib/byte_array.dart:901: length * this.bytesPerElement()); Good question. Keeping the code exactly ...
8 years, 6 months ago (2012-06-22 04:27:00 UTC) #4
siva
8 years, 6 months ago (2012-06-22 18:12:30 UTC) #5
lgtm

http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart
File runtime/lib/byte_array.dart (right):

http://codereview.chromium.org/10653002/diff/1/runtime/lib/byte_array.dart#ne...
runtime/lib/byte_array.dart:2198: int setInt8(int byteOffset, int value) {
dst.setInt8(pos, x); is equivalent to dst[pos] = x;

but 
pos += (dst[pos] = x);
is not quite the same, that is what makes it confusing 

On 2012/06/22 04:27:00, cshapiro wrote:
> Another good question!  This is actually documented in the interface. 
> Basically, the amount of bytes displaced is returned so you can write code
like
> this
> 
>   pos += dst.setInt8(pos, x);
>   pos += dst.setFloat64(pos, y);
>   pos += dst.setUint16(pos, z);
>  
> when writing formatted binary data

http://codereview.chromium.org/10653002/diff/1/runtime/tests/vm/dart/byte_arr...
File runtime/tests/vm/dart/byte_array_test.dart (right):

http://codereview.chromium.org/10653002/diff/1/runtime/tests/vm/dart/byte_arr...
runtime/tests/vm/dart/byte_array_test.dart:937: Expect.isTrue(whole is
Int8List);
No I meant just one negative test each just to ensure that the implementation
does not always return true.

On 2012/06/22 04:27:00, cshapiro wrote:
> Probably not a bad idea.  However, I do a lot of these tests so I should add
> them in all places that I do a type test and that probably merits another
> change.
> 
> Should I test that all other type tests answer false or just the unsigned
> variant?  Let me know, I'll add this in another change set.

Powered by Google App Engine
This is Rietveld 408576698