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

Side by Side Diff: lib/runtime/dart/html_common.js

Issue 1554683002: Update to latest analyzer (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 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 | « lib/runtime/dart/html.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/html_common', null, /* Imports */[ 1 dart_library.library('dart/html_common', null, /* Imports */[
2 "dart/_runtime", 2 "dart/_runtime",
3 'dart/_metadata', 3 'dart/_metadata',
4 'dart/core', 4 'dart/core',
5 'dart/html', 5 'dart/html',
6 'dart/typed_data', 6 'dart/typed_data',
7 'dart/_js_helper', 7 'dart/_js_helper',
8 'dart/_native_typed_data', 8 'dart/_native_typed_data',
9 'dart/async', 9 'dart/async',
10 'dart/collection', 10 'dart/collection',
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 contains(value) { 87 contains(value) {
88 if (!(typeof value == 'string')) return false; 88 if (!(typeof value == 'string')) return false;
89 this[_validateToken](dart.as(value, core.String)); 89 this[_validateToken](dart.as(value, core.String));
90 return this.readClasses().contains(value); 90 return this.readClasses().contains(value);
91 } 91 }
92 lookup(value) { 92 lookup(value) {
93 return dart.as(dart.notNull(this.contains(value)) ? value : null, core.Str ing); 93 return dart.as(dart.notNull(this.contains(value)) ? value : null, core.Str ing);
94 } 94 }
95 add(value) { 95 add(value) {
96 this[_validateToken](value); 96 this[_validateToken](value);
97 return dart.as(this.modify(dart.fn(s => dart.dsend(s, 'add', value))), cor e.bool); 97 return dart.as(this.modify(dart.fn(s => s.add(value), core.bool, [core.Set $(core.String)])), core.bool);
98 } 98 }
99 remove(value) { 99 remove(value) {
100 this[_validateToken](dart.as(value, core.String)); 100 this[_validateToken](dart.as(value, core.String));
101 if (!(typeof value == 'string')) return false; 101 if (!(typeof value == 'string')) return false;
102 let s = this.readClasses(); 102 let s = this.readClasses();
103 let result = s.remove(value); 103 let result = s.remove(value);
104 this.writeClasses(s); 104 this.writeClasses(s);
105 return result; 105 return result;
106 } 106 }
107 addAll(iterable) { 107 addAll(iterable) {
108 this.modify(dart.fn((s => dart.dsend(s, 'addAll', iterable[dartx.map](dart .bind(this, _validateToken)))).bind(this))); 108 this.modify(dart.fn((s => s.addAll(iterable[dartx.map](dart.bind(this, _va lidateToken)))).bind(this), dart.void, [core.Set$(core.String)]));
109 } 109 }
110 removeAll(iterable) { 110 removeAll(iterable) {
111 this.modify(dart.fn((s => dart.dsend(s, 'removeAll', iterable[dartx.map](d art.as(dart.bind(this, _validateToken), __CastType0)))).bind(this))); 111 this.modify(dart.fn((s => s.removeAll(iterable[dartx.map](dart.as(dart.bin d(this, _validateToken), __CastType0)))).bind(this), dart.void, [core.Set$(core. String)]));
112 } 112 }
113 toggleAll(iterable, shouldAdd) { 113 toggleAll(iterable, shouldAdd) {
114 if (shouldAdd === void 0) shouldAdd = null; 114 if (shouldAdd === void 0) shouldAdd = null;
115 iterable[dartx.forEach](dart.fn((e => this.toggle(dart.as(e, core.String), shouldAdd)).bind(this), core.bool, [dart.dynamic])); 115 iterable[dartx.forEach](dart.fn((e => this.toggle(e, shouldAdd)).bind(this ), core.bool, [core.String]));
116 } 116 }
117 retainAll(iterable) { 117 retainAll(iterable) {
118 this.modify(dart.fn(s => dart.dsend(s, 'retainAll', iterable))); 118 this.modify(dart.fn(s => s.retainAll(iterable), dart.void, [core.Set$(core .String)]));
119 } 119 }
120 removeWhere(test) { 120 removeWhere(test) {
121 this.modify(dart.fn(s => dart.dsend(s, 'removeWhere', test))); 121 this.modify(dart.fn(s => s.removeWhere(test), dart.void, [core.Set$(core.S tring)]));
122 } 122 }
123 retainWhere(test) { 123 retainWhere(test) {
124 this.modify(dart.fn(s => dart.dsend(s, 'retainWhere', test))); 124 this.modify(dart.fn(s => s.retainWhere(test), dart.void, [core.Set$(core.S tring)]));
125 } 125 }
126 containsAll(collection) { 126 containsAll(collection) {
127 return this.readClasses().containsAll(collection); 127 return this.readClasses().containsAll(collection);
128 } 128 }
129 intersection(other) { 129 intersection(other) {
130 return this.readClasses().intersection(other); 130 return this.readClasses().intersection(other);
131 } 131 }
132 union(other) { 132 union(other) {
133 return this.readClasses().union(other); 133 return this.readClasses().union(other);
134 } 134 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 let orElse = opts && 'orElse' in opts ? opts.orElse : null; 171 let orElse = opts && 'orElse' in opts ? opts.orElse : null;
172 return this.readClasses().lastWhere(test, {orElse: orElse}); 172 return this.readClasses().lastWhere(test, {orElse: orElse});
173 } 173 }
174 singleWhere(test) { 174 singleWhere(test) {
175 return this.readClasses().singleWhere(test); 175 return this.readClasses().singleWhere(test);
176 } 176 }
177 elementAt(index) { 177 elementAt(index) {
178 return this.readClasses().elementAt(index); 178 return this.readClasses().elementAt(index);
179 } 179 }
180 clear() { 180 clear() {
181 this.modify(dart.fn(s => dart.dsend(s, 'clear'))); 181 this.modify(dart.fn(s => s.clear(), dart.void, [core.Set$(core.String)]));
182 } 182 }
183 modify(f) { 183 modify(f) {
184 let s = this.readClasses(); 184 let s = this.readClasses();
185 let ret = f(s); 185 let ret = f(s);
186 this.writeClasses(s); 186 this.writeClasses(s);
187 return ret; 187 return ret;
188 } 188 }
189 } 189 }
190 CssClassSetImpl[dart.implements] = () => [html.CssClassSet]; 190 CssClassSetImpl[dart.implements] = () => [html.CssClassSet];
191 dart.setSignature(CssClassSetImpl, { 191 dart.setSignature(CssClassSetImpl, {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 'length', 256 'length',
257 'first', 257 'first',
258 'last', 258 'last',
259 'single' 259 'single'
260 ]); 260 ]);
261 dart.defineLazyProperties(CssClassSetImpl, { 261 dart.defineLazyProperties(CssClassSetImpl, {
262 get _validTokenRE() { 262 get _validTokenRE() {
263 return core.RegExp.new('^\\S+$'); 263 return core.RegExp.new('^\\S+$');
264 } 264 }
265 }); 265 });
266 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(dart.d ynamic, [core.Object])); 266 const __CastType0 = dart.typedef('__CastType0', () => dart.functionType(core.S tring, [core.Object]));
267 function convertDartToNative_SerializedScriptValue(value) { 267 function convertDartToNative_SerializedScriptValue(value) {
268 return convertDartToNative_PrepareForStructuredClone(value); 268 return convertDartToNative_PrepareForStructuredClone(value);
269 } 269 }
270 dart.fn(convertDartToNative_SerializedScriptValue); 270 dart.fn(convertDartToNative_SerializedScriptValue);
271 function convertNativeToDart_SerializedScriptValue(object) { 271 function convertNativeToDart_SerializedScriptValue(object) {
272 return convertNativeToDart_AcceptStructuredClone(object, {mustCopy: true}); 272 return convertNativeToDart_AcceptStructuredClone(object, {mustCopy: true});
273 } 273 }
274 dart.fn(convertNativeToDart_SerializedScriptValue); 274 dart.fn(convertNativeToDart_SerializedScriptValue);
275 class _StructuredClone extends core.Object { 275 class _StructuredClone extends core.Object {
276 _StructuredClone() { 276 _StructuredClone() {
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]); 498 dart.fn(convertNativeToDart_Dictionary, core.Map, [dart.dynamic]);
499 function convertDartToNative_Dictionary(dict, postCreate) { 499 function convertDartToNative_Dictionary(dict, postCreate) {
500 if (postCreate === void 0) postCreate = null; 500 if (postCreate === void 0) postCreate = null;
501 if (dict == null) return null; 501 if (dict == null) return null;
502 let object = {}; 502 let object = {};
503 if (postCreate != null) { 503 if (postCreate != null) {
504 dart.dcall(postCreate, object); 504 dart.dcall(postCreate, object);
505 } 505 }
506 dict.forEach(dart.fn((key, value) => { 506 dict.forEach(dart.fn((key, value) => {
507 object[key] = value; 507 object[key] = value;
508 }, dart.dynamic, [core.String, dart.dynamic])); 508 }, dart.void, [core.String, dart.dynamic]));
509 return object; 509 return object;
510 } 510 }
511 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]); 511 dart.fn(convertDartToNative_Dictionary, dart.dynamic, [core.Map], [dart.functi onType(dart.void, [dart.dynamic])]);
512 function convertDartToNative_StringArray(input) { 512 function convertDartToNative_StringArray(input) {
513 return input; 513 return input;
514 } 514 }
515 dart.fn(convertDartToNative_StringArray, core.List, [core.List$(core.String)]) ; 515 dart.fn(convertDartToNative_StringArray, core.List, [core.List$(core.String)]) ;
516 function convertNativeToDart_DateTime(date) { 516 function convertNativeToDart_DateTime(date) {
517 let millisSinceEpoch = date.getTime(); 517 let millisSinceEpoch = date.getTime();
518 return new core.DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, {isUtc : true}); 518 return new core.DateTime.fromMillisecondsSinceEpoch(millisSinceEpoch, {isUtc : true});
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 function convertNativePromiseToDartFuture(promise) { 611 function convertNativePromiseToDartFuture(promise) {
612 let completer = async.Completer.new(); 612 let completer = async.Completer.new();
613 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1); 613 let then = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJS , dart.fn(result => completer.complete(result), dart.void, [dart.dynamic]), 1);
614 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1); 614 let error = dart.dcall(/* Unimplemented unknown name */convertDartClosureToJ S, dart.fn(result => completer.completeError(result), dart.void, [dart.dynamic]) , 1);
615 let newPromise = promise.then(then).catch(error); 615 let newPromise = promise.then(then).catch(error);
616 return completer.future; 616 return completer.future;
617 } 617 }
618 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]); 618 dart.fn(convertNativePromiseToDartFuture, async.Future, [dart.dynamic]);
619 class Device extends core.Object { 619 class Device extends core.Object {
620 static get userAgent() { 620 static get userAgent() {
621 return dart.as(html.window.navigator.userAgent, core.String); 621 return dart.as(dart.dload(html.window.navigator, 'userAgent'), core.String );
622 } 622 }
623 static get isOpera() { 623 static get isOpera() {
624 if (Device._isOpera == null) { 624 if (Device._isOpera == null) {
625 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0); 625 Device._isOpera = Device.userAgent[dartx.contains]("Opera", 0);
626 } 626 }
627 return Device._isOpera; 627 return Device._isOpera;
628 } 628 }
629 static get isIE() { 629 static get isIE() {
630 if (Device._isIE == null) { 630 if (Device._isIE == null) {
631 Device._isIE = !dart.notNull(Device.isOpera) && dart.notNull(Device.user Agent[dartx.contains]("Trident/", 0)); 631 Device._isIE = !dart.notNull(Device.isOpera) && dart.notNull(Device.user Agent[dartx.contains]("Trident/", 0));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 const _childNodes = Symbol('_childNodes'); 695 const _childNodes = Symbol('_childNodes');
696 const _node = Symbol('_node'); 696 const _node = Symbol('_node');
697 const _iterable = Symbol('_iterable'); 697 const _iterable = Symbol('_iterable');
698 const _filtered = Symbol('_filtered'); 698 const _filtered = Symbol('_filtered');
699 class FilteredElementList extends collection.ListBase$(html.Element) { 699 class FilteredElementList extends collection.ListBase$(html.Element) {
700 FilteredElementList(node) { 700 FilteredElementList(node) {
701 this[_childNodes] = node.nodes; 701 this[_childNodes] = node.nodes;
702 this[_node] = node; 702 this[_node] = node;
703 } 703 }
704 get [_iterable]() { 704 get [_iterable]() {
705 return new _internal.WhereIterable(this[_childNodes], dart.fn(n => dart.is (n, html.Element), core.bool, [dart.dynamic])); 705 return new (_internal.WhereIterable$(html.Element))(this[_childNodes], dar t.fn(n => dart.is(n, html.Element), core.bool, [html.Element]));
706 } 706 }
707 get [_filtered]() { 707 get [_filtered]() {
708 return core.List$(html.Element).from(this[_iterable], {growable: false}); 708 return core.List$(html.Element).from(this[_iterable], {growable: false});
709 } 709 }
710 forEach(f) { 710 forEach(f) {
711 this[_filtered][dartx.forEach](f); 711 this[_filtered][dartx.forEach](f);
712 } 712 }
713 set(index, value) { 713 set(index, value) {
714 this.get(index).replaceWith(value); 714 this.get(index).replaceWith(value);
715 return value; 715 return value;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list')); 748 dart.throw(new core.UnsupportedError('Cannot setRange on filtered list'));
749 } 749 }
750 fillRange(start, end, fillValue) { 750 fillRange(start, end, fillValue) {
751 if (fillValue === void 0) fillValue = null; 751 if (fillValue === void 0) fillValue = null;
752 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ; 752 dart.throw(new core.UnsupportedError('Cannot fillRange on filtered list')) ;
753 } 753 }
754 replaceRange(start, end, iterable) { 754 replaceRange(start, end, iterable) {
755 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list ')); 755 dart.throw(new core.UnsupportedError('Cannot replaceRange on filtered list '));
756 } 756 }
757 removeRange(start, end) { 757 removeRange(start, end) {
758 core.List.from(this[_iterable][dartx.skip](start)[dartx.take](dart.notNull (end) - dart.notNull(start)))[dartx.forEach](dart.fn(el => dart.dsend(el, 'remov e'))); 758 core.List.from(this[_iterable][dartx.skip](start)[dartx.take](dart.notNull (end) - dart.notNull(start)))[dartx.forEach](dart.fn(el => dart.dsend(el, 'remov e'), dart.void, [dart.dynamic]));
759 } 759 }
760 clear() { 760 clear() {
761 this[_childNodes][dartx.clear](); 761 this[_childNodes][dartx.clear]();
762 } 762 }
763 removeLast() { 763 removeLast() {
764 let result = this[_iterable][dartx.last]; 764 let result = this[_iterable][dartx.last];
765 if (result != null) { 765 if (result != null) {
766 result.remove(); 766 result.remove();
767 } 767 }
768 return result; 768 return result;
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 exports.isJavaScriptArray = isJavaScriptArray; 921 exports.isJavaScriptArray = isJavaScriptArray;
922 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject; 922 exports.isJavaScriptSimpleObject = isJavaScriptSimpleObject;
923 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray; 923 exports.isImmutableJavaScriptArray = isImmutableJavaScriptArray;
924 exports.isJavaScriptPromise = isJavaScriptPromise; 924 exports.isJavaScriptPromise = isJavaScriptPromise;
925 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture; 925 exports.convertNativePromiseToDartFuture = convertNativePromiseToDartFuture;
926 exports.Device = Device; 926 exports.Device = Device;
927 exports.FilteredElementList = FilteredElementList; 927 exports.FilteredElementList = FilteredElementList;
928 exports.Lists = Lists; 928 exports.Lists = Lists;
929 exports.NodeListWrapper = NodeListWrapper; 929 exports.NodeListWrapper = NodeListWrapper;
930 }); 930 });
OLDNEW
« no previous file with comments | « lib/runtime/dart/html.js ('k') | lib/runtime/dart/isolate.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698