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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 11417060: Remive uses of "void operator[]() => ..." in the html library and enable return type checks for all… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 library html; 1 library html;
2 2
3 import 'dart:isolate'; 3 import 'dart:isolate';
4 import 'dart:json'; 4 import 'dart:json';
5 import 'dart:svg' as svg; 5 import 'dart:svg' as svg;
6 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 6 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
7 // for details. All rights reserved. Use of this source code is governed by a 7 // for details. All rights reserved. Use of this source code is governed by a
8 // BSD-style license that can be found in the LICENSE file. 8 // BSD-style license that can be found in the LICENSE file.
9 9
10 // DO NOT EDIT 10 // DO NOT EDIT
(...skipping 8944 matching lines...) Expand 10 before | Expand all | Expand 10 after
8955 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => 8955 factory Float32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) =>
8956 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length); 8956 _TypedArrayFactoryProvider.createFloat32Array_fromBuffer(buffer, byteOffset, length);
8957 8957
8958 static const int BYTES_PER_ELEMENT = 4; 8958 static const int BYTES_PER_ELEMENT = 4;
8959 8959
8960 /** @domName Float32Array.length */ 8960 /** @domName Float32Array.length */
8961 final int length; 8961 final int length;
8962 8962
8963 num operator[](int index) => JS("num", "#[#]", this, index); 8963 num operator[](int index) => JS("num", "#[#]", this, index);
8964 8964
8965 void operator[]=(int index, num value) => JS("void", "#[#] = #", this, index, value); 8965 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); }
8966 // -- start List<num> mixins. 8966 // -- start List<num> mixins.
8967 // num is the element type. 8967 // num is the element type.
8968 8968
8969 // From Iterable<num>: 8969 // From Iterable<num>:
8970 8970
8971 Iterator<num> iterator() { 8971 Iterator<num> iterator() {
8972 // Note: NodeLists are not fixed size. And most probably length shouldn't 8972 // Note: NodeLists are not fixed size. And most probably length shouldn't
8973 // be cached in both iterator _and_ forEach method. For now caching it 8973 // be cached in both iterator _and_ forEach method. For now caching it
8974 // for consistency. 8974 // for consistency.
8975 return new FixedSizeListIterator<num>(this); 8975 return new FixedSizeListIterator<num>(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
9066 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) => 9066 factory Float64Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int lengt h]) =>
9067 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length); 9067 _TypedArrayFactoryProvider.createFloat64Array_fromBuffer(buffer, byteOffset, length);
9068 9068
9069 static const int BYTES_PER_ELEMENT = 8; 9069 static const int BYTES_PER_ELEMENT = 8;
9070 9070
9071 /** @domName Float64Array.length */ 9071 /** @domName Float64Array.length */
9072 final int length; 9072 final int length;
9073 9073
9074 num operator[](int index) => JS("num", "#[#]", this, index); 9074 num operator[](int index) => JS("num", "#[#]", this, index);
9075 9075
9076 void operator[]=(int index, num value) => JS("void", "#[#] = #", this, index, value); 9076 void operator[]=(int index, num value) { JS("void", "#[#] = #", this, index, v alue); }
9077 // -- start List<num> mixins. 9077 // -- start List<num> mixins.
9078 // num is the element type. 9078 // num is the element type.
9079 9079
9080 // From Iterable<num>: 9080 // From Iterable<num>:
9081 9081
9082 Iterator<num> iterator() { 9082 Iterator<num> iterator() {
9083 // Note: NodeLists are not fixed size. And most probably length shouldn't 9083 // Note: NodeLists are not fixed size. And most probably length shouldn't
9084 // be cached in both iterator _and_ forEach method. For now caching it 9084 // be cached in both iterator _and_ forEach method. For now caching it
9085 // for consistency. 9085 // for consistency.
9086 return new FixedSizeListIterator<num>(this); 9086 return new FixedSizeListIterator<num>(this);
(...skipping 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
11187 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 11187 factory Int16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
11188 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength); 11188 _TypedArrayFactoryProvider.createInt16Array_fromBuffer(buffer, byteOffset, l ength);
11189 11189
11190 static const int BYTES_PER_ELEMENT = 2; 11190 static const int BYTES_PER_ELEMENT = 2;
11191 11191
11192 /** @domName Int16Array.length */ 11192 /** @domName Int16Array.length */
11193 final int length; 11193 final int length;
11194 11194
11195 int operator[](int index) => JS("int", "#[#]", this, index); 11195 int operator[](int index) => JS("int", "#[#]", this, index);
11196 11196
11197 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 11197 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
11198 // -- start List<int> mixins. 11198 // -- start List<int> mixins.
11199 // int is the element type. 11199 // int is the element type.
11200 11200
11201 // From Iterable<int>: 11201 // From Iterable<int>:
11202 11202
11203 Iterator<int> iterator() { 11203 Iterator<int> iterator() {
11204 // Note: NodeLists are not fixed size. And most probably length shouldn't 11204 // Note: NodeLists are not fixed size. And most probably length shouldn't
11205 // be cached in both iterator _and_ forEach method. For now caching it 11205 // be cached in both iterator _and_ forEach method. For now caching it
11206 // for consistency. 11206 // for consistency.
11207 return new FixedSizeListIterator<int>(this); 11207 return new FixedSizeListIterator<int>(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
11298 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 11298 factory Int32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
11299 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength); 11299 _TypedArrayFactoryProvider.createInt32Array_fromBuffer(buffer, byteOffset, l ength);
11300 11300
11301 static const int BYTES_PER_ELEMENT = 4; 11301 static const int BYTES_PER_ELEMENT = 4;
11302 11302
11303 /** @domName Int32Array.length */ 11303 /** @domName Int32Array.length */
11304 final int length; 11304 final int length;
11305 11305
11306 int operator[](int index) => JS("int", "#[#]", this, index); 11306 int operator[](int index) => JS("int", "#[#]", this, index);
11307 11307
11308 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 11308 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
11309 // -- start List<int> mixins. 11309 // -- start List<int> mixins.
11310 // int is the element type. 11310 // int is the element type.
11311 11311
11312 // From Iterable<int>: 11312 // From Iterable<int>:
11313 11313
11314 Iterator<int> iterator() { 11314 Iterator<int> iterator() {
11315 // Note: NodeLists are not fixed size. And most probably length shouldn't 11315 // Note: NodeLists are not fixed size. And most probably length shouldn't
11316 // be cached in both iterator _and_ forEach method. For now caching it 11316 // be cached in both iterator _and_ forEach method. For now caching it
11317 // for consistency. 11317 // for consistency.
11318 return new FixedSizeListIterator<int>(this); 11318 return new FixedSizeListIterator<int>(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
11409 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) => 11409 factory Int8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length]) =>
11410 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth); 11410 _TypedArrayFactoryProvider.createInt8Array_fromBuffer(buffer, byteOffset, le ngth);
11411 11411
11412 static const int BYTES_PER_ELEMENT = 1; 11412 static const int BYTES_PER_ELEMENT = 1;
11413 11413
11414 /** @domName Int8Array.length */ 11414 /** @domName Int8Array.length */
11415 final int length; 11415 final int length;
11416 11416
11417 int operator[](int index) => JS("int", "#[#]", this, index); 11417 int operator[](int index) => JS("int", "#[#]", this, index);
11418 11418
11419 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 11419 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
11420 // -- start List<int> mixins. 11420 // -- start List<int> mixins.
11421 // int is the element type. 11421 // int is the element type.
11422 11422
11423 // From Iterable<int>: 11423 // From Iterable<int>:
11424 11424
11425 Iterator<int> iterator() { 11425 Iterator<int> iterator() {
11426 // Note: NodeLists are not fixed size. And most probably length shouldn't 11426 // Note: NodeLists are not fixed size. And most probably length shouldn't
11427 // be cached in both iterator _and_ forEach method. For now caching it 11427 // be cached in both iterator _and_ forEach method. For now caching it
11428 // for consistency. 11428 // for consistency.
11429 return new FixedSizeListIterator<int>(this); 11429 return new FixedSizeListIterator<int>(this);
(...skipping 5215 matching lines...) Expand 10 before | Expand all | Expand 10 after
16645 16645
16646 class Storage implements Map<String, String> native "*Storage" { 16646 class Storage implements Map<String, String> native "*Storage" {
16647 16647
16648 // TODO(nweiz): update this when maps support lazy iteration 16648 // TODO(nweiz): update this when maps support lazy iteration
16649 bool containsValue(String value) => values.some((e) => e == value); 16649 bool containsValue(String value) => values.some((e) => e == value);
16650 16650
16651 bool containsKey(String key) => $dom_getItem(key) != null; 16651 bool containsKey(String key) => $dom_getItem(key) != null;
16652 16652
16653 String operator [](String key) => $dom_getItem(key); 16653 String operator [](String key) => $dom_getItem(key);
16654 16654
16655 void operator []=(String key, String value) => $dom_setItem(key, value); 16655 void operator []=(String key, String value) { $dom_setItem(key, value); }
16656 16656
16657 String putIfAbsent(String key, String ifAbsent()) { 16657 String putIfAbsent(String key, String ifAbsent()) {
16658 if (!containsKey(key)) this[key] = ifAbsent(); 16658 if (!containsKey(key)) this[key] = ifAbsent();
16659 return this[key]; 16659 return this[key];
16660 } 16660 }
16661 16661
16662 String remove(String key) { 16662 String remove(String key) {
16663 final value = this[key]; 16663 final value = this[key];
16664 $dom_removeItem(key); 16664 $dom_removeItem(key);
16665 return value; 16665 return value;
(...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after
17989 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => 17989 factory Uint16Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) =>
17990 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length); 17990 _TypedArrayFactoryProvider.createUint16Array_fromBuffer(buffer, byteOffset, length);
17991 17991
17992 static const int BYTES_PER_ELEMENT = 2; 17992 static const int BYTES_PER_ELEMENT = 2;
17993 17993
17994 /** @domName Uint16Array.length */ 17994 /** @domName Uint16Array.length */
17995 final int length; 17995 final int length;
17996 17996
17997 int operator[](int index) => JS("int", "#[#]", this, index); 17997 int operator[](int index) => JS("int", "#[#]", this, index);
17998 17998
17999 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 17999 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
18000 // -- start List<int> mixins. 18000 // -- start List<int> mixins.
18001 // int is the element type. 18001 // int is the element type.
18002 18002
18003 // From Iterable<int>: 18003 // From Iterable<int>:
18004 18004
18005 Iterator<int> iterator() { 18005 Iterator<int> iterator() {
18006 // Note: NodeLists are not fixed size. And most probably length shouldn't 18006 // Note: NodeLists are not fixed size. And most probably length shouldn't
18007 // be cached in both iterator _and_ forEach method. For now caching it 18007 // be cached in both iterator _and_ forEach method. For now caching it
18008 // for consistency. 18008 // for consistency.
18009 return new FixedSizeListIterator<int>(this); 18009 return new FixedSizeListIterator<int>(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
18100 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) => 18100 factory Uint32Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length ]) =>
18101 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length); 18101 _TypedArrayFactoryProvider.createUint32Array_fromBuffer(buffer, byteOffset, length);
18102 18102
18103 static const int BYTES_PER_ELEMENT = 4; 18103 static const int BYTES_PER_ELEMENT = 4;
18104 18104
18105 /** @domName Uint32Array.length */ 18105 /** @domName Uint32Array.length */
18106 final int length; 18106 final int length;
18107 18107
18108 int operator[](int index) => JS("int", "#[#]", this, index); 18108 int operator[](int index) => JS("int", "#[#]", this, index);
18109 18109
18110 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 18110 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
18111 // -- start List<int> mixins. 18111 // -- start List<int> mixins.
18112 // int is the element type. 18112 // int is the element type.
18113 18113
18114 // From Iterable<int>: 18114 // From Iterable<int>:
18115 18115
18116 Iterator<int> iterator() { 18116 Iterator<int> iterator() {
18117 // Note: NodeLists are not fixed size. And most probably length shouldn't 18117 // Note: NodeLists are not fixed size. And most probably length shouldn't
18118 // be cached in both iterator _and_ forEach method. For now caching it 18118 // be cached in both iterator _and_ forEach method. For now caching it
18119 // for consistency. 18119 // for consistency.
18120 return new FixedSizeListIterator<int>(this); 18120 return new FixedSizeListIterator<int>(this);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
18211 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) => 18211 factory Uint8Array.fromBuffer(ArrayBuffer buffer, [int byteOffset, int length] ) =>
18212 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength); 18212 _TypedArrayFactoryProvider.createUint8Array_fromBuffer(buffer, byteOffset, l ength);
18213 18213
18214 static const int BYTES_PER_ELEMENT = 1; 18214 static const int BYTES_PER_ELEMENT = 1;
18215 18215
18216 /** @domName Uint8Array.length */ 18216 /** @domName Uint8Array.length */
18217 final int length; 18217 final int length;
18218 18218
18219 int operator[](int index) => JS("int", "#[#]", this, index); 18219 int operator[](int index) => JS("int", "#[#]", this, index);
18220 18220
18221 void operator[]=(int index, int value) => JS("void", "#[#] = #", this, index, value); 18221 void operator[]=(int index, int value) { JS("void", "#[#] = #", this, index, v alue); }
18222 // -- start List<int> mixins. 18222 // -- start List<int> mixins.
18223 // int is the element type. 18223 // int is the element type.
18224 18224
18225 // From Iterable<int>: 18225 // From Iterable<int>:
18226 18226
18227 Iterator<int> iterator() { 18227 Iterator<int> iterator() {
18228 // Note: NodeLists are not fixed size. And most probably length shouldn't 18228 // Note: NodeLists are not fixed size. And most probably length shouldn't
18229 // be cached in both iterator _and_ forEach method. For now caching it 18229 // be cached in both iterator _and_ forEach method. For now caching it
18230 // for consistency. 18230 // for consistency.
18231 return new FixedSizeListIterator<int>(this); 18231 return new FixedSizeListIterator<int>(this);
(...skipping 6767 matching lines...) Expand 10 before | Expand all | Expand 10 after
24999 if (length < 0) throw new ArgumentError('length'); 24999 if (length < 0) throw new ArgumentError('length');
25000 if (start < 0) throw new RangeError.value(start); 25000 if (start < 0) throw new RangeError.value(start);
25001 int end = start + length; 25001 int end = start + length;
25002 if (end > a.length) throw new RangeError.value(end); 25002 if (end > a.length) throw new RangeError.value(end);
25003 for (int i = start; i < end; i++) { 25003 for (int i = start; i < end; i++) {
25004 accumulator.add(a[i]); 25004 accumulator.add(a[i]);
25005 } 25005 }
25006 return accumulator; 25006 return accumulator;
25007 } 25007 }
25008 } 25008 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/html/scripts/systemhtml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698