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

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 1914583002: Use _downcast and _cast instead of "as" to reduce dart2js output size. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 part of $LIBRARYNAME; 5 part of $LIBRARYNAME;
6 6
7 class _ChildrenElementList extends ListBase<Element> 7 class _ChildrenElementList extends ListBase<Element>
8 implements NodeListWrapper { 8 implements NodeListWrapper {
9 // Raw Element. 9 // Raw Element.
10 final Element _element; 10 final Element _element;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 _FrozenElementList._wrap(this._nodeList) { 274 _FrozenElementList._wrap(this._nodeList) {
275 this.dartClass_instance = this._nodeList; 275 this.dartClass_instance = this._nodeList;
276 } 276 }
277 $else 277 $else
278 _FrozenElementList._wrap(this._nodeList); 278 _FrozenElementList._wrap(this._nodeList);
279 $endif 279 $endif
280 280
281 int get length => _nodeList.length; 281 int get length => _nodeList.length;
282 282
283 E operator [](int index) => _nodeList[index] as E; 283 E operator [](int index) => _downcast/*<Node, E>*/(_nodeList[index]);
284 284
285 void operator []=(int index, E value) { 285 void operator []=(int index, E value) {
286 throw new UnsupportedError('Cannot modify list'); 286 throw new UnsupportedError('Cannot modify list');
287 } 287 }
288 288
289 set length(int newLength) { 289 set length(int newLength) {
290 throw new UnsupportedError('Cannot modify list'); 290 throw new UnsupportedError('Cannot modify list');
291 } 291 }
292 292
293 void sort([Comparator<E> compare]) { 293 void sort([Comparator<E> compare]) {
294 throw new UnsupportedError('Cannot sort list'); 294 throw new UnsupportedError('Cannot sort list');
295 } 295 }
296 296
297 void shuffle([Random random]) { 297 void shuffle([Random random]) {
298 throw new UnsupportedError('Cannot shuffle list'); 298 throw new UnsupportedError('Cannot shuffle list');
299 } 299 }
300 300
301 E get first => _nodeList.first as E; 301 E get first => _downcast/*<Node, E>*/(_nodeList.first);
302 302
303 E get last => _nodeList.last as E; 303 E get last => _downcast/*<Node, E>*/(_nodeList.last);
304 304
305 E get single => _nodeList.single as E; 305 E get single => _downcast/*<Node, E>*/(_nodeList.single);
306 306
307 CssClassSet get classes => new _MultiElementCssClassSet(this); 307 CssClassSet get classes => new _MultiElementCssClassSet(this);
308 308
309 CssStyleDeclarationBase get style => 309 CssStyleDeclarationBase get style =>
310 new _CssStyleDeclarationSet(this); 310 new _CssStyleDeclarationSet(this);
311 311
312 set classes(Iterable<String> value) { 312 set classes(Iterable<String> value) {
313 // TODO(sra): This might be faster for Sets: 313 // TODO(sra): This might be faster for Sets:
314 // 314 //
315 // new _MultiElementCssClassSet(this).writeClasses(value) 315 // new _MultiElementCssClassSet(this).writeClasses(value)
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1669 const ScrollAlignment._internal(this._value); 1669 const ScrollAlignment._internal(this._value);
1670 toString() => 'ScrollAlignment.$_value'; 1670 toString() => 'ScrollAlignment.$_value';
1671 1671
1672 /// Attempt to align the element to the top of the scrollable area. 1672 /// Attempt to align the element to the top of the scrollable area.
1673 static const TOP = const ScrollAlignment._internal('TOP'); 1673 static const TOP = const ScrollAlignment._internal('TOP');
1674 /// Attempt to center the element in the scrollable area. 1674 /// Attempt to center the element in the scrollable area.
1675 static const CENTER = const ScrollAlignment._internal('CENTER'); 1675 static const CENTER = const ScrollAlignment._internal('CENTER');
1676 /// Attempt to align the element to the bottom of the scrollable area. 1676 /// Attempt to align the element to the bottom of the scrollable area.
1677 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1677 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1678 } 1678 }
OLDNEW
« no previous file with comments | « tools/dom/src/WrappedList.dart ('k') | tools/dom/templates/html/impl/impl_IDBFactory.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698