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

Side by Side Diff: pkg/compiler/lib/src/helpers/debug_collection.dart

Issue 2150333002: Serialize this-types in NativeBehavior separately. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend_serialization.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 typedef void DebugCallback(String methodName, var arg1, var arg2); 5 typedef void DebugCallback(String methodName, var arg1, var arg2);
6 6
7 class DebugMap<K, V> implements Map<K, V> { 7 class DebugMap<K, V> implements Map<K, V> {
8 final Map<K, V> map; 8 final Map<K, V> map;
9 DebugCallback indexSetCallBack; 9 DebugCallback indexSetCallBack;
10 DebugCallback putIfAbsentCallBack; 10 DebugCallback putIfAbsentCallBack;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return iterable.firstWhere(test, orElse: orElse); 124 return iterable.firstWhere(test, orElse: orElse);
125 } 125 }
126 126
127 E lastWhere(bool test(E element), {E orElse()}) { 127 E lastWhere(bool test(E element), {E orElse()}) {
128 return iterable.lastWhere(test, orElse: orElse); 128 return iterable.lastWhere(test, orElse: orElse);
129 } 129 }
130 130
131 E singleWhere(bool test(E element)) => iterable.singleWhere(test); 131 E singleWhere(bool test(E element)) => iterable.singleWhere(test);
132 132
133 E elementAt(int index) => iterable.elementAt(index); 133 E elementAt(int index) => iterable.elementAt(index);
134
135 String toString() => iterable.toString();
134 } 136 }
135 137
136 class DebugList<E> extends DebugIterable<E> implements List<E> { 138 class DebugList<E> extends DebugIterable<E> implements List<E> {
137 DebugCallback addCallback; 139 DebugCallback addCallback;
140 DebugCallback addAllCallback;
138 141
139 DebugList(List<E> list, {this.addCallback}) : super(list); 142 DebugList(List<E> list, {this.addCallback, this.addAllCallback})
143 : super(list);
140 144
141 List<E> get list => iterable; 145 List<E> get list => iterable;
142 146
143 E operator [](int index) => list[index]; 147 E operator [](int index) => list[index];
144 148
145 void operator []=(int index, E value) { 149 void operator []=(int index, E value) {
146 list[index] = value; 150 list[index] = value;
147 } 151 }
148 152
149 int get length => list.length; 153 int get length => list.length;
150 154
151 void set length(int newLength) { 155 void set length(int newLength) {
152 list.length = newLength; 156 list.length = newLength;
153 } 157 }
154 158
155 void add(E value) { 159 void add(E value) {
156 if (addCallback != null) { 160 if (addCallback != null) {
157 addCallback('add', value, null); 161 addCallback('add', value, null);
158 } 162 }
159 list.add(value); 163 list.add(value);
160 } 164 }
161 165
162 void addAll(Iterable<E> iterable) => list.addAll(iterable); 166 void addAll(Iterable<E> iterable) {
167 if (addAllCallback != null) {
168 addAllCallback('addAll', iterable, null);
169 }
170 list.addAll(iterable);
171 }
163 172
164 Iterable<E> get reversed => list.reversed; 173 Iterable<E> get reversed => list.reversed;
165 174
166 void sort([int compare(E a, E b)]) => list.sort(compare); 175 void sort([int compare(E a, E b)]) => list.sort(compare);
167 176
168 void shuffle([random]) => list.shuffle(random); 177 void shuffle([random]) => list.shuffle(random);
169 178
170 int indexOf(E element, [int start = 0]) => list.indexOf(element, start); 179 int indexOf(E element, [int start = 0]) => list.indexOf(element, start);
171 180
172 int lastIndexOf(E element, [int start]) => list.lastIndexOf(element, start); 181 int lastIndexOf(E element, [int start]) => list.lastIndexOf(element, start);
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 check(element, '$methodName: '); 328 check(element, '$methodName: ');
320 } 329 }
321 330
322 void check(var element, [String text = '']) { 331 void check(var element, [String text = '']) {
323 String elementType = '${element.runtimeType}'; 332 String elementType = '${element.runtimeType}';
324 if (runtimeTypes.contains(elementType)) return; 333 if (runtimeTypes.contains(elementType)) return;
325 throw '$name: $text$elementType' 334 throw '$name: $text$elementType'
326 '${showObjects ? ' ($element)' : ''}'; 335 '${showObjects ? ' ($element)' : ''}';
327 } 336 }
328 } 337 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend_serialization.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698