Commit graph

225 commits

Author SHA1 Message Date
Florian Loitsch e1bf3506d1 Make linked-list non-circular.
This bug was introduced when making the collection library strong-mode clean.

Fixes #26522
BUG= http://dartbug.com/26522
R=lrn@google.com

Review URL: https://codereview.chromium.org/2015513006 .
2016-06-01 14:19:37 +02:00
Lasse R.H. Nielsen fbf64bb7a5 Make Iterable.toList more efficient if the length is known.
Add more tests. Fix (some) bugs found by tests.

R=floitsch@google.com

Review URL: https://codereview.chromium.org/1999793002.
2016-05-23 10:00:19 +02:00
Florian Loitsch 2203c54cbb Fix documentation for LinkedHashSet.
Fixes #26496
BUG= http://dartbug.com/26496

Review URL: https://codereview.chromium.org/1999783002 .
2016-05-20 14:36:38 +02:00
Florian Loitsch ac0a5ef431 Fix documentation for identity sets/maps.
Fixes #26503
BUG= http://dartbug.com/26503
R=lrn@google.com

Review URL: https://codereview.chromium.org/2002593002 .
2016-05-20 14:29:14 +02:00
Florian Loitsch 1e3b98278a Make DoubleLinkedQueueEntry subclassable again.
Also, add back the `remove` function that was accidentally removed.

R=lrn@google.com

Review URL: https://codereview.chromium.org/1973903005 .
2016-05-17 12:54:12 +02:00
Florian Loitsch e19addf23e Make dart:collection strong-mode clean.
R=leafp@google.com

Review URL: https://codereview.chromium.org/1937103002 .
2016-05-11 16:28:43 +02:00
Florian Loitsch b19e00c2d4 Fix Set.from which still had a generic type on the incoming Iterable.
Follow-up fix for http://dartbug.com/21731
Also see https://codereview.chromium.org/838463002/

R=lrn@google.com

Review URL: https://codereview.chromium.org/1887883006 .
2016-04-28 15:01:04 +02:00
Florian Loitsch a96120243a Merge pull request #26330 from sethladd/library-level-import-docs
add library-level docs to help with importing
2016-04-27 14:01:01 +02:00
Florian Loitsch 516c09cb1f Fix documentation for identity collections.
BUG= http://dartbug.com/26326

Review URL: https://codereview.chromium.org/1922083002 .
2016-04-26 11:35:30 +02:00
Seth Ladd a875749e82 add library-level docs to help with importing 2016-04-25 12:41:24 -07:00
Florian Loitsch 111a794141 Fix documentation for identity hashmap.
Fixes 26326.
BUG= http://dartbug.com/26326

Review URL: https://codereview.chromium.org/1921663002 .
2016-04-25 15:56:32 +02:00
Leaf Petersen 92edd907c1 Add generic annotations to more SDK APIs.
Fixes https://github.com/dart-lang/sdk/issues/25860 .

BUG=
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1815583002 .
2016-03-28 17:52:40 -07:00
Vijay Menon 89ccefe462 Add generic method info to ListMixin
These match those already in iterable.dart

Fixes #25408

R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1665463002 .
2016-02-03 11:26:53 -08:00
Florian Loitsch 1a3853b128 Improve comment in UnmodifiableListView.
The class already states that the source must have efficient-length, but
the constructor didn't reiterate this requirement.

R=lrn@google.com

Review URL: https://codereview.chromium.org/1510043002 .
2015-12-09 21:25:55 +01:00
John Messerly 49c24b83da add generic method comments to a few SDK methods
R=lrn@google.com

Review URL: https://codereview.chromium.org/1462743002 .
2015-11-24 09:20:49 -08:00
Lasse R.H. Nielsen d4d71dd632 Make MapMixin putIfAbsent use containsKey.
Fixes issue #24560
BUG= http://dartbug.com/24560
R=floitsch@google.com

Review URL: https://codereview.chromium.org/1390163004.
2015-10-13 16:12:58 +02:00
Lasse R.H. Nielsen 4e94938f7e Fix some cases where Map.containsValue did not accept Object as argument.
Add tests.
Also remove a left-over check in SplayTreeMap.

BUG= https://github.com/dart-lang/dev_compiler/issues/344
R=wibling@google.com

Review URL: https://codereview.chromium.org//1360053003 .
2015-09-23 11:26:55 +02:00
Kevin Millikin 95860326cd Fix a typo in the documentation for HashMap.
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1337873003 .
2015-09-11 11:28:10 +02:00
Lasse R.H. Nielsen 1b8f3fba14 Make List constructor give better error messages for non-int arguments
BUG= http://dartbug.com/15986
R=herhut@google.com, iposva@google.com, sra@google.com

Committed: 33c7663826

Review URL: https://codereview.chromium.org//1214723009 .
2015-08-17 13:01:13 +02:00
Lasse R.H. Nielsen 51fa195f16 Revert "Make List constructor give better error messages for non-int arguments"
There are VM-only tests that assume exact text of failure.

BUG=

Review URL: https://codereview.chromium.org//1294483003 .
2015-08-14 15:05:17 +02:00
Lasse R.H. Nielsen 33c7663826 Make List constructor give better error messages for non-int arguments
BUG= http://dartbug.com/15986
R=herhut@google.com, iposva@google.com, sra@google.com

Review URL: https://codereview.chromium.org//1214723009 .
2015-08-14 13:44:19 +02:00
Seth Ladd b30a7a1750 change param name to match docs
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1287453002 .
2015-08-11 10:55:16 -07:00
Lasse R.H. Nielsen 6f2dd2552c Fix typo in ListMixin.insertAll.
Also add test for input iterable being linked to receiver list.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1146163004
2015-06-02 11:58:35 +02:00
Lasse R.H. Nielsen babcd4e9c0 Revert "Make EfficientLength public, as EfficientLengthIterable."
It's still not a good solution for detecting an Iterable with an efficient
length. It's not inherited by, e.g., a DelegatingIterable wrapper or similar
generic Iterable transformers.

Keep this as an internal optimization for quickly detecting the most common
efficient-length Iterable classes (List, Set, Queue, Map.keys/values), but
don't make it public.

A *real* solution would be adding a hasEfficientLength getter to Iterable, or
adding an efficientLength getter that may return null if it's not efficient.
This would something that a wrapper can attach to.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1154263003
2015-05-29 12:52:45 +02:00
lrn@google.com 4d539e4975 Fix typo in EfficientLengthIterable documentation, and improve it slightly.
R=kustermann@google.com

Review URL: https://codereview.chromium.org//1132503002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45586 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-07 10:18:36 +00:00
lrn@google.com 92c526b2a2 Make EfficientLength public, as EfficientLengthIterable.
R=iposva@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//1104063002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45556 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 09:00:45 +00:00
lrn@google.com b3d466a1ca Update {,Linked}Hash{Set,Map} documentation.
Now specifies that the default [isValidKey] accepts all values in the
default and identity cases.

BUG= http://dartbug.com/23356
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1130453003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45552 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 08:35:23 +00:00
lrn@google.com 7fe3363524 Fix SplayTreeMap.from ignoring the compare and isValidKey arguments.
BUG= http://dartbug.com/23387
R=wibling@google.com

Review URL: https://codereview.chromium.org//1127043002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45550 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-06 08:18:56 +00:00
kevmoo@google.com ba757ecc5e dart:* API fixes for docs
plus other cleanup

R=lrn@google.com

Review URL: https://codereview.chromium.org//1120293002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45482 260f80e4-7a28-3924-810f-c04153c831b5
2015-05-03 21:21:53 +00:00
lrn@google.com 0e22f7402f Move implementation from IterableBase to Iterable.
Keep IterableBase around, but just extend Iterable.

There is no good reason to have IterableBase different from Iterable. The only argument is to be consistent with ListBase, but that's also inconsistent with, e.g., Stream.
ListBase only exists because List uses the default List constructor, so it's not a good super-class. As a usability-tradeoff, the ListBase class exists as a super-class.
Iterable doesn't have the same problem, so applying that "trade-off" has no up-side.

(A better long-term solution would be to be able to designate another constructor as the default "super()" constructor to call, so List could be used as a superclass).

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1025573005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45096 260f80e4-7a28-3924-810f-c04153c831b5
2015-04-13 12:26:15 +00:00
sra@google.com c53c7c735a Use _nextLink instead of _next for better type inferencing.
This recovers ~400 of the ~1400 byte regression on r44451.

The _next field was inferred as  Union of [[null|exact=LinkedHashSetCell], [null|subclass=_DoubleLink]]

Another way to fix this issue would be to make queue.dart a sub-library.

R=lrn@google.com

Review URL: https://codereview.chromium.org//1010493006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44508 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-16 15:11:25 +00:00
lrn@google.com da8f80ec29 Another type warning fixed.
Review URL: https://codereview.chromium.org//1007523004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44457 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 12:27:02 +00:00
lrn@google.com d95f622154 Fix incorrect type in double-linked queue.
Review URL: https://codereview.chromium.org//1005963002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44455 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 10:41:24 +00:00
lrn@google.com f80cfe1401 Fix DoubleLinkedQueue so that appending to entries also update the queue length.
The extra non-queue features of this class are probably unnecessary, and are not proper naming (some functions should be getters).

Keeping unchanged for backwards compatibility, but it should probably either be removed or be suitably updated for 2.0.

BUG= http://dartbug.com/22802
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1001863002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44451 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-13 09:40:57 +00:00
lrn@google.com 3f1780f70d Change List/Set/Map/Queue.from constructrs to accept any iterable.
This allows using the .from constructor as a cast:

  new Set<int>.from(numSetContainingOnlyInts);

BUG= http://dartbug.com/21731
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//838463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42620 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-06 10:14:56 +00:00
jacobr@google.com 5fe403d861 Fix a couple type bugs in dart html and what seems like strange type choices in dart:core
BUG=
R=vsm@google.com

Review URL: https://codereview.chromium.org//794953002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42550 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 18:49:07 +00:00
jacobr@google.com 614d8d3ac5 Revert "Tighten a couple type annotations in IterableMixin"
This reverts commit 16cd67c34742199fb9d28082636e372352cb3a1a.

This change breaks a c019 test.
BUG=

Review URL: https://codereview.chromium.org//800943002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42342 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-12 18:30:21 +00:00
jacobr@google.com 6dc988a6d9 Tighten a couple type annotations in IterableMixin
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//791453005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42334 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-12 18:00:46 +00:00
fschneider@google.com a49870e721 VM: Remove use of IterableMixinWorkaround from _List, _ImmutableList and _GrowableList.
_List, _ImmutableList and _GrowableList now extend ListBase which uses ListMixin.

Note that typed data lists are still using IterableMixinWorkaround for now.
They will be changed in a separate CL since it involves a few more changes
to the VM.

BUG=dartbug.com/13647
R=lrn@google.com

Review URL: https://codereview.chromium.org//730543002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42061 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-02 10:38:51 +00:00
lrn@google.com 6ae29ec58e Create generic check methods for RangeError causing checks.
Use them where appropriate in core libraries.

There are many more possible uses in vm- and dart2js-libraries.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//745573002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41893 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 10:29:15 +00:00
fschneider@google.com 4e318fb22e In ListBase always return Iterable with the correct type argument.
R=lrn@google.com

Review URL: https://codereview.chromium.org//720153003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41737 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-14 11:34:36 +00:00
lrn@google.com 42dac4c7b4 Add some ArgumentError and RangeError constructors that capture more information.
Switch some uses of RangeError.range to RangeError.index.
Fix bug in Queue where elementAt allowed `length` as input.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//711003002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41653 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-11 07:55:47 +00:00
lrn@google.com 583f408260 Fix type in generic type of parameters to SplayTreeMap.fromIterable.
Add tests.

BUG = http://dartbug.com/21542
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//716513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41624 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-10 10:39:28 +00:00
nweiz@google.com 75a0128a52 Add a QueueList class to the collection package.
This class is based on the ListQueue implementation and implements both the
Queue and List interfaces.

R=lrn@google.com

Review URL: https://codereview.chromium.org//660373002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41467 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-03 20:39:26 +00:00
lrn@google.com cd16d94f1e Add concurrent modification check to ListMixin/IterableMixin.reduce.
Add tests of reduce and fold.

BUG= http://dartbug.com/21289
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//656773002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41093 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-14 09:12:21 +00:00
lrn@google.com 4d4c8a6332 Make Iterable.toSet say that it returns a Set with the same equality as the Iterable's contains method.
Let's consider whether this is really desirable once more.
It seems messy, but so does not doing it.

R=ajohnsen@google.com, floitsch@google.com

Review URL: https://codereview.chromium.org//451633003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40893 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-03 07:43:10 +00:00
floitsch@google.com a0d250aa80 Fix typo in linked hashmap documentation.
BUG= http://dartbug.com/21158
R=lrn@google.com

Review URL: https://codereview.chromium.org//617253002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40835 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-01 12:01:04 +00:00
lrn@google.com 6c6208f3fc Update some documentations.
BUG= http://dartbug.com/19729
BUG= http://dartbug.com/19671
BUG= http://dartbug.com/20732

Review URL: https://codereview.chromium.org//610343002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@40769 260f80e4-7a28-3924-810f-c04153c831b5
2014-09-29 13:56:41 +00:00
lrn@google.com 729de01f79 Make IterableMixinWorkaround using classes return correctly typed Iterables.
BUG= http://dartbug.com/13646
R=floitsch@google.com

Review URL: https://codereview.chromium.org//397243002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38372 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-18 08:08:16 +00:00
kustermann@google.com 8f2c3e1d66 Equivalence relations are symmetric not anti-symmetric
R=lrn@google.com

Review URL: https://codereview.chromium.org//397153002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@38322 260f80e4-7a28-3924-810f-c04153c831b5
2014-07-17 08:25:27 +00:00