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

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

Issue 1117793002: add checks needed for covariant generics, and List<E> (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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/_internal.js ('k') | lib/runtime/dart/async.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 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class NoSideEffects extends core.Object { 4 class NoSideEffects extends core.Object {
5 NoSideEffects() { 5 NoSideEffects() {
6 } 6 }
7 } 7 }
8 class NoThrows extends core.Object { 8 class NoThrows extends core.Object {
9 NoThrows() { 9 NoThrows() {
10 } 10 }
(...skipping 23 matching lines...) Expand all
34 get isNotEmpty() { 34 get isNotEmpty() {
35 return !dart.notNull(this.isEmpty); 35 return !dart.notNull(this.isEmpty);
36 } 36 }
37 toString() { 37 toString() {
38 return collection.Maps.mapToString(this); 38 return collection.Maps.mapToString(this);
39 } 39 }
40 [_throwUnmodifiable]() { 40 [_throwUnmodifiable]() {
41 throw new core.UnsupportedError("Cannot modify unmodifiable Map"); 41 throw new core.UnsupportedError("Cannot modify unmodifiable Map");
42 } 42 }
43 set(key, val) { 43 set(key, val) {
44 dart.as(key, K);
45 dart.as(val, V);
44 return this[_throwUnmodifiable](); 46 return this[_throwUnmodifiable]();
45 } 47 }
46 putIfAbsent(key, ifAbsent) { 48 putIfAbsent(key, ifAbsent) {
49 dart.as(key, K);
50 dart.as(ifAbsent, dart.functionType(V, []));
47 return dart.as(this[_throwUnmodifiable](), V); 51 return dart.as(this[_throwUnmodifiable](), V);
48 } 52 }
49 remove(key) { 53 remove(key) {
54 dart.as(key, K);
50 return dart.as(this[_throwUnmodifiable](), V); 55 return dart.as(this[_throwUnmodifiable](), V);
51 } 56 }
52 clear() { 57 clear() {
53 return this[_throwUnmodifiable](); 58 return this[_throwUnmodifiable]();
54 } 59 }
55 addAll(other) { 60 addAll(other) {
61 dart.as(other, core.Map$(K, V));
56 return this[_throwUnmodifiable](); 62 return this[_throwUnmodifiable]();
57 } 63 }
58 } 64 }
59 ConstantMap[dart.implements] = () => [core.Map$(K, V)]; 65 ConstantMap[dart.implements] = () => [core.Map$(K, V)];
60 dart.defineNamedConstructor(ConstantMap, '_'); 66 dart.defineNamedConstructor(ConstantMap, '_');
61 return ConstantMap; 67 return ConstantMap;
62 }); 68 });
63 let ConstantMap = ConstantMap$(); 69 let ConstantMap = ConstantMap$();
64 let _jsObject = Symbol('_jsObject'); 70 let _jsObject = Symbol('_jsObject');
65 let _keys = Symbol('_keys'); 71 let _keys = Symbol('_keys');
66 let _fetch = Symbol('_fetch'); 72 let _fetch = Symbol('_fetch');
67 let ConstantStringMap$ = dart.generic(function(K, V) { 73 let ConstantStringMap$ = dart.generic(function(K, V) {
68 class ConstantStringMap extends ConstantMap$(K, V) { 74 class ConstantStringMap extends ConstantMap$(K, V) {
69 _(length, jsObject, keys) { 75 _(length, jsObject, keys) {
70 this.length = length; 76 this.length = length;
71 this[_jsObject] = jsObject; 77 this[_jsObject] = jsObject;
72 this[_keys] = keys; 78 this[_keys] = keys;
73 super._(); 79 super._();
74 } 80 }
75 containsValue(needle) { 81 containsValue(needle) {
82 dart.as(needle, V);
76 return this.values[core.$any](value => dart.equals(value, needle)); 83 return this.values[core.$any](value => dart.equals(value, needle));
77 } 84 }
78 containsKey(key) { 85 containsKey(key) {
79 if (!(typeof key == 'string')) 86 if (!(typeof key == 'string'))
80 return false; 87 return false;
81 if (dart.equals('__proto__', key)) 88 if (dart.equals('__proto__', key))
82 return false; 89 return false;
83 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 90 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
84 } 91 }
85 get(key) { 92 get(key) {
86 if (!dart.notNull(this.containsKey(key))) 93 if (!dart.notNull(this.containsKey(key)))
87 return null; 94 return null;
88 return dart.as(this[_fetch](key), V); 95 return dart.as(this[_fetch](key), V);
89 } 96 }
90 [_fetch](key) { 97 [_fetch](key) {
91 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); 98 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String));
92 } 99 }
93 forEach(f) { 100 forEach(f) {
101 dart.as(f, dart.functionType(dart.void, [K, V]));
94 let keys = this[_keys]; 102 let keys = this[_keys];
95 for (let i = 0; core.int['<'](i, dart.dload(keys, 'length')); i = dart.n otNull(i) + 1) { 103 for (let i = 0; core.int['<'](i, dart.dload(keys, 'length')); i = dart.n otNull(i) + 1) {
96 let key = dart.dindex(keys, i); 104 let key = dart.dindex(keys, i);
97 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 105 f(dart.as(key, K), dart.as(this[_fetch](key), V));
98 } 106 }
99 } 107 }
100 get keys() { 108 get keys() {
101 return new (_ConstantMapKeyIterable$(K))(this); 109 return new (_ConstantMapKeyIterable$(K))(this);
102 } 110 }
103 get values() { 111 get values() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 super._(); 165 super._();
158 } 166 }
159 [_getMap]() { 167 [_getMap]() {
160 if (!this.$map) { 168 if (!this.$map) {
161 let backingMap = new (collection.LinkedHashMap$(K, V))(); 169 let backingMap = new (collection.LinkedHashMap$(K, V))();
162 this.$map = fillLiteralMap(this[_jsData], backingMap); 170 this.$map = fillLiteralMap(this[_jsData], backingMap);
163 } 171 }
164 return this.$map; 172 return this.$map;
165 } 173 }
166 containsValue(needle) { 174 containsValue(needle) {
175 dart.as(needle, V);
167 return this[_getMap]().containsValue(needle); 176 return this[_getMap]().containsValue(needle);
168 } 177 }
169 containsKey(key) { 178 containsKey(key) {
170 return this[_getMap]().containsKey(key); 179 return this[_getMap]().containsKey(key);
171 } 180 }
172 get(key) { 181 get(key) {
173 return this[_getMap]().get(key); 182 return this[_getMap]().get(key);
174 } 183 }
175 forEach(f) { 184 forEach(f) {
185 dart.as(f, dart.functionType(dart.void, [K, V]));
176 this[_getMap]().forEach(f); 186 this[_getMap]().forEach(f);
177 } 187 }
178 get keys() { 188 get keys() {
179 return this[_getMap]().keys; 189 return this[_getMap]().keys;
180 } 190 }
181 get values() { 191 get values() {
182 return this[_getMap]().values; 192 return this[_getMap]().values;
183 } 193 }
184 get length() { 194 get length() {
185 return this[_getMap]().length; 195 return this[_getMap]().length;
(...skipping 3877 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 exports.jsonEncodeNative = jsonEncodeNative; 4073 exports.jsonEncodeNative = jsonEncodeNative;
4064 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4074 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4065 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4075 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4066 exports.DeferredLoadCallback = DeferredLoadCallback; 4076 exports.DeferredLoadCallback = DeferredLoadCallback;
4067 exports.loadDeferredLibrary = loadDeferredLibrary; 4077 exports.loadDeferredLibrary = loadDeferredLibrary;
4068 exports.MainError = MainError; 4078 exports.MainError = MainError;
4069 exports.missingMain = missingMain; 4079 exports.missingMain = missingMain;
4070 exports.badMain = badMain; 4080 exports.badMain = badMain;
4071 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4081 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4072 })(_js_helper || (_js_helper = {})); 4082 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_internal.js ('k') | lib/runtime/dart/async.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698