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

Unified Diff: dart/pkg/compiler/lib/src/util/link_implementation.dart

Issue 744023002: Add Link.copyWithout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | « dart/pkg/compiler/lib/src/util/link.dart ('k') | dart/tests/compiler/dart2js/link_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/compiler/lib/src/util/link_implementation.dart
diff --git a/dart/pkg/compiler/lib/src/util/link_implementation.dart b/dart/pkg/compiler/lib/src/util/link_implementation.dart
index 16997e91d07876a71a438bd91a4e74c108075eb5..5359102e86f9aa6a39b8a80e16f08a4670e41672 100644
--- a/dart/pkg/compiler/lib/src/util/link_implementation.dart
+++ b/dart/pkg/compiler/lib/src/util/link_implementation.dart
@@ -136,6 +136,17 @@ class LinkEntry<T> extends Link<T> {
int get hashCode => throw new UnsupportedError('LinkEntry.hashCode');
int slowLength() => 1 + tail.slowLength();
+
+ Link copyWithout(e) {
+ LinkBuilder copy = new LinkBuilder();
+ Link link = this;
+ for (; !link.isEmpty; link = link.tail) {
+ if (link.head != e) {
+ copy.addLast(link.head);
+ }
+ }
+ return copy.toLink(link);
+ }
}
class LinkBuilderImplementation<T> implements LinkBuilder<T> {
« no previous file with comments | « dart/pkg/compiler/lib/src/util/link.dart ('k') | dart/tests/compiler/dart2js/link_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698