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

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
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) {
56 return this[_throwUnmodifiable](); 61 return this[_throwUnmodifiable]();
57 } 62 }
58 } 63 }
59 ConstantMap[dart.implements] = () => [core.Map$(K, V)]; 64 ConstantMap[dart.implements] = () => [core.Map$(K, V)];
60 dart.defineNamedConstructor(ConstantMap, '_'); 65 dart.defineNamedConstructor(ConstantMap, '_');
61 return ConstantMap; 66 return ConstantMap;
62 }); 67 });
63 let ConstantMap = ConstantMap$(); 68 let ConstantMap = ConstantMap$();
64 let _jsObject = Symbol('_jsObject'); 69 let _jsObject = Symbol('_jsObject');
65 let _keys = Symbol('_keys'); 70 let _keys = Symbol('_keys');
66 let _fetch = Symbol('_fetch'); 71 let _fetch = Symbol('_fetch');
67 let ConstantStringMap$ = dart.generic(function(K, V) { 72 let ConstantStringMap$ = dart.generic(function(K, V) {
68 class ConstantStringMap extends ConstantMap$(K, V) { 73 class ConstantStringMap extends ConstantMap$(K, V) {
69 _(length, jsObject, keys) { 74 _(length, jsObject, keys) {
70 this.length = length; 75 this.length = length;
71 this[_jsObject] = jsObject; 76 this[_jsObject] = jsObject;
72 this[_keys] = keys; 77 this[_keys] = keys;
73 super._(); 78 super._();
74 } 79 }
75 containsValue(needle) { 80 containsValue(needle) {
81 dart.as(needle, V);
76 return this.values[core.$any](value => dart.equals(value, needle)); 82 return this.values[core.$any](value => dart.equals(value, needle));
77 } 83 }
78 containsKey(key) { 84 containsKey(key) {
79 if (!(typeof key == 'string')) 85 if (!(typeof key == 'string'))
80 return false; 86 return false;
81 if (dart.equals('__proto__', key)) 87 if (dart.equals('__proto__', key))
82 return false; 88 return false;
83 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 89 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
84 } 90 }
85 get(key) { 91 get(key) {
(...skipping 20 matching lines...) Expand all
106 } 112 }
107 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength]; 113 ConstantStringMap[dart.implements] = () => [_internal.EfficientLength];
108 dart.defineNamedConstructor(ConstantStringMap, '_'); 114 dart.defineNamedConstructor(ConstantStringMap, '_');
109 return ConstantStringMap; 115 return ConstantStringMap;
110 }); 116 });
111 let ConstantStringMap = ConstantStringMap$(); 117 let ConstantStringMap = ConstantStringMap$();
112 let _protoValue = Symbol('_protoValue'); 118 let _protoValue = Symbol('_protoValue');
113 let ConstantProtoMap$ = dart.generic(function(K, V) { 119 let ConstantProtoMap$ = dart.generic(function(K, V) {
114 class ConstantProtoMap extends ConstantStringMap$(K, V) { 120 class ConstantProtoMap extends ConstantStringMap$(K, V) {
115 _(length, jsObject, keys, protoValue) { 121 _(length, jsObject, keys, protoValue) {
122 dart.as(protoValue, V);
116 this[_protoValue] = protoValue; 123 this[_protoValue] = protoValue;
117 super._(dart.as(length, core.int), jsObject, dart.as(keys, core.List$(K) )); 124 super._(dart.as(length, core.int), jsObject, dart.as(keys, core.List$(K) ));
118 } 125 }
119 containsKey(key) { 126 containsKey(key) {
120 if (!(typeof key == 'string')) 127 if (!(typeof key == 'string'))
121 return false; 128 return false;
122 if (dart.equals('__proto__', key)) 129 if (dart.equals('__proto__', key))
123 return true; 130 return true;
124 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String)); 131 return jsHasOwnProperty(this[_jsObject], dart.as(key, core.String));
125 } 132 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 super._(); 164 super._();
158 } 165 }
159 [_getMap]() { 166 [_getMap]() {
160 if (!this.$map) { 167 if (!this.$map) {
161 let backingMap = new (collection.LinkedHashMap$(K, V))(); 168 let backingMap = new (collection.LinkedHashMap$(K, V))();
162 this.$map = fillLiteralMap(this[_jsData], backingMap); 169 this.$map = fillLiteralMap(this[_jsData], backingMap);
163 } 170 }
164 return this.$map; 171 return this.$map;
165 } 172 }
166 containsValue(needle) { 173 containsValue(needle) {
174 dart.as(needle, V);
167 return this[_getMap]().containsValue(needle); 175 return this[_getMap]().containsValue(needle);
168 } 176 }
169 containsKey(key) { 177 containsKey(key) {
170 return this[_getMap]().containsKey(key); 178 return this[_getMap]().containsKey(key);
171 } 179 }
172 get(key) { 180 get(key) {
173 return this[_getMap]().get(key); 181 return this[_getMap]().get(key);
174 } 182 }
175 forEach(f) { 183 forEach(f) {
176 this[_getMap]().forEach(f); 184 this[_getMap]().forEach(f);
(...skipping 3886 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 exports.jsonEncodeNative = jsonEncodeNative; 4071 exports.jsonEncodeNative = jsonEncodeNative;
4064 exports.getIsolateAffinityTag = getIsolateAffinityTag; 4072 exports.getIsolateAffinityTag = getIsolateAffinityTag;
4065 exports.LoadLibraryFunctionType = LoadLibraryFunctionType; 4073 exports.LoadLibraryFunctionType = LoadLibraryFunctionType;
4066 exports.DeferredLoadCallback = DeferredLoadCallback; 4074 exports.DeferredLoadCallback = DeferredLoadCallback;
4067 exports.loadDeferredLibrary = loadDeferredLibrary; 4075 exports.loadDeferredLibrary = loadDeferredLibrary;
4068 exports.MainError = MainError; 4076 exports.MainError = MainError;
4069 exports.missingMain = missingMain; 4077 exports.missingMain = missingMain;
4070 exports.badMain = badMain; 4078 exports.badMain = badMain;
4071 exports.mainHasTooManyParameters = mainHasTooManyParameters; 4079 exports.mainHasTooManyParameters = mainHasTooManyParameters;
4072 })(_js_helper || (_js_helper = {})); 4080 })(_js_helper || (_js_helper = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698