OLD | NEW |
| (Empty) |
1 dart_library.library('collection/src/unmodifiable_wrappers', null, /* Imports */
[ | |
2 'dart/_runtime', | |
3 'dart/collection', | |
4 'dart/core' | |
5 ], /* Lazy imports */[ | |
6 'collection/wrappers' | |
7 ], function(exports, dart, collection, core, wrappers) { | |
8 'use strict'; | |
9 let dartx = dart.dartx; | |
10 dart.export(exports, collection, ['UnmodifiableListView', 'UnmodifiableMapView
'], []); | |
11 const NonGrowableListMixin$ = dart.generic(function(E) { | |
12 class NonGrowableListMixin extends core.Object { | |
13 static _throw() { | |
14 dart.throw(new core.UnsupportedError("Cannot change the length of a fixe
d-length list")); | |
15 } | |
16 set length(newLength) { | |
17 return NonGrowableListMixin$()._throw(); | |
18 } | |
19 add(value) { | |
20 dart.as(value, E); | |
21 return dart.as(NonGrowableListMixin$()._throw(), core.bool); | |
22 } | |
23 addAll(iterable) { | |
24 dart.as(iterable, core.Iterable$(E)); | |
25 return NonGrowableListMixin$()._throw(); | |
26 } | |
27 insert(index, element) { | |
28 dart.as(element, E); | |
29 return NonGrowableListMixin$()._throw(); | |
30 } | |
31 insertAll(index, iterable) { | |
32 dart.as(iterable, core.Iterable$(E)); | |
33 return NonGrowableListMixin$()._throw(); | |
34 } | |
35 remove(value) { | |
36 return dart.as(NonGrowableListMixin$()._throw(), core.bool); | |
37 } | |
38 removeAt(index) { | |
39 return dart.as(NonGrowableListMixin$()._throw(), E); | |
40 } | |
41 removeLast() { | |
42 return dart.as(NonGrowableListMixin$()._throw(), E); | |
43 } | |
44 removeWhere(test) { | |
45 dart.as(test, dart.functionType(core.bool, [E])); | |
46 return NonGrowableListMixin$()._throw(); | |
47 } | |
48 retainWhere(test) { | |
49 dart.as(test, dart.functionType(core.bool, [E])); | |
50 return NonGrowableListMixin$()._throw(); | |
51 } | |
52 removeRange(start, end) { | |
53 return NonGrowableListMixin$()._throw(); | |
54 } | |
55 replaceRange(start, end, iterable) { | |
56 dart.as(iterable, core.Iterable$(E)); | |
57 return NonGrowableListMixin$()._throw(); | |
58 } | |
59 clear() { | |
60 return NonGrowableListMixin$()._throw(); | |
61 } | |
62 } | |
63 NonGrowableListMixin[dart.implements] = () => [core.List$(E)]; | |
64 dart.setSignature(NonGrowableListMixin, { | |
65 methods: () => ({ | |
66 add: [core.bool, [E]], | |
67 addAll: [dart.void, [core.Iterable$(E)]], | |
68 insert: [dart.void, [core.int, E]], | |
69 insertAll: [dart.void, [core.int, core.Iterable$(E)]], | |
70 remove: [core.bool, [core.Object]], | |
71 removeAt: [E, [core.int]], | |
72 removeLast: [E, []], | |
73 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]], | |
74 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]], | |
75 removeRange: [dart.void, [core.int, core.int]], | |
76 replaceRange: [dart.void, [core.int, core.int, core.Iterable$(E)]], | |
77 clear: [dart.void, []] | |
78 }), | |
79 statics: () => ({_throw: [dart.dynamic, []]}), | |
80 names: ['_throw'] | |
81 }); | |
82 dart.defineExtensionMembers(NonGrowableListMixin, [ | |
83 'add', | |
84 'addAll', | |
85 'insert', | |
86 'insertAll', | |
87 'remove', | |
88 'removeAt', | |
89 'removeLast', | |
90 'removeWhere', | |
91 'retainWhere', | |
92 'removeRange', | |
93 'replaceRange', | |
94 'clear', | |
95 'length' | |
96 ]); | |
97 return NonGrowableListMixin; | |
98 }); | |
99 let NonGrowableListMixin = NonGrowableListMixin$(); | |
100 const NonGrowableListView$ = dart.generic(function(E) { | |
101 class NonGrowableListView extends dart.mixin(wrappers.DelegatingList$(E), No
nGrowableListMixin$(E)) { | |
102 NonGrowableListView(listBase) { | |
103 super.DelegatingList(listBase); | |
104 } | |
105 } | |
106 dart.setSignature(NonGrowableListView, { | |
107 constructors: () => ({NonGrowableListView: [exports.NonGrowableListView$(E
), [core.List$(E)]]}) | |
108 }); | |
109 return NonGrowableListView; | |
110 }); | |
111 dart.defineLazyClassGeneric(exports, 'NonGrowableListView', {get: NonGrowableL
istView$}); | |
112 const _throw = Symbol('_throw'); | |
113 const UnmodifiableSetMixin$ = dart.generic(function(E) { | |
114 class UnmodifiableSetMixin extends core.Object { | |
115 [_throw]() { | |
116 dart.throw(new core.UnsupportedError("Cannot modify an unmodifiable Set"
)); | |
117 } | |
118 add(value) { | |
119 dart.as(value, E); | |
120 return dart.as(this[_throw](), core.bool); | |
121 } | |
122 addAll(elements) { | |
123 dart.as(elements, core.Iterable$(E)); | |
124 return this[_throw](); | |
125 } | |
126 remove(value) { | |
127 return dart.as(this[_throw](), core.bool); | |
128 } | |
129 removeAll(elements) { | |
130 return this[_throw](); | |
131 } | |
132 retainAll(elements) { | |
133 return this[_throw](); | |
134 } | |
135 removeWhere(test) { | |
136 dart.as(test, dart.functionType(core.bool, [E])); | |
137 return this[_throw](); | |
138 } | |
139 retainWhere(test) { | |
140 dart.as(test, dart.functionType(core.bool, [E])); | |
141 return this[_throw](); | |
142 } | |
143 clear() { | |
144 return this[_throw](); | |
145 } | |
146 } | |
147 UnmodifiableSetMixin[dart.implements] = () => [core.Set$(E)]; | |
148 dart.setSignature(UnmodifiableSetMixin, { | |
149 methods: () => ({ | |
150 [_throw]: [dart.dynamic, []], | |
151 add: [core.bool, [E]], | |
152 addAll: [dart.void, [core.Iterable$(E)]], | |
153 remove: [core.bool, [core.Object]], | |
154 removeAll: [dart.void, [core.Iterable]], | |
155 retainAll: [dart.void, [core.Iterable]], | |
156 removeWhere: [dart.void, [dart.functionType(core.bool, [E])]], | |
157 retainWhere: [dart.void, [dart.functionType(core.bool, [E])]], | |
158 clear: [dart.void, []] | |
159 }) | |
160 }); | |
161 return UnmodifiableSetMixin; | |
162 }); | |
163 let UnmodifiableSetMixin = UnmodifiableSetMixin$(); | |
164 const UnmodifiableSetView$ = dart.generic(function(E) { | |
165 class UnmodifiableSetView extends dart.mixin(wrappers.DelegatingSet$(E), Unm
odifiableSetMixin$(E)) { | |
166 UnmodifiableSetView(setBase) { | |
167 super.DelegatingSet(setBase); | |
168 } | |
169 } | |
170 dart.setSignature(UnmodifiableSetView, { | |
171 constructors: () => ({UnmodifiableSetView: [exports.UnmodifiableSetView$(E
), [core.Set$(E)]]}) | |
172 }); | |
173 return UnmodifiableSetView; | |
174 }); | |
175 dart.defineLazyClassGeneric(exports, 'UnmodifiableSetView', {get: Unmodifiable
SetView$}); | |
176 const UnmodifiableMapMixin$ = dart.generic(function(K, V) { | |
177 class UnmodifiableMapMixin extends core.Object { | |
178 static _throw() { | |
179 dart.throw(new core.UnsupportedError("Cannot modify an unmodifiable Map"
)); | |
180 } | |
181 set(key, value) { | |
182 (() => { | |
183 dart.as(key, K); | |
184 dart.as(value, V); | |
185 return UnmodifiableMapMixin$()._throw(); | |
186 })(); | |
187 return value; | |
188 } | |
189 putIfAbsent(key, ifAbsent) { | |
190 dart.as(key, K); | |
191 dart.as(ifAbsent, dart.functionType(V, [])); | |
192 return dart.as(UnmodifiableMapMixin$()._throw(), V); | |
193 } | |
194 addAll(other) { | |
195 dart.as(other, core.Map$(K, V)); | |
196 return UnmodifiableMapMixin$()._throw(); | |
197 } | |
198 remove(key) { | |
199 return dart.as(UnmodifiableMapMixin$()._throw(), V); | |
200 } | |
201 clear() { | |
202 return UnmodifiableMapMixin$()._throw(); | |
203 } | |
204 } | |
205 UnmodifiableMapMixin[dart.implements] = () => [core.Map$(K, V)]; | |
206 dart.setSignature(UnmodifiableMapMixin, { | |
207 methods: () => ({ | |
208 set: [dart.void, [K, V]], | |
209 putIfAbsent: [V, [K, dart.functionType(V, [])]], | |
210 addAll: [dart.void, [core.Map$(K, V)]], | |
211 remove: [V, [core.Object]], | |
212 clear: [dart.void, []] | |
213 }), | |
214 statics: () => ({_throw: [dart.dynamic, []]}), | |
215 names: ['_throw'] | |
216 }); | |
217 return UnmodifiableMapMixin; | |
218 }); | |
219 let UnmodifiableMapMixin = UnmodifiableMapMixin$(); | |
220 // Exports: | |
221 exports.NonGrowableListMixin$ = NonGrowableListMixin$; | |
222 exports.NonGrowableListMixin = NonGrowableListMixin; | |
223 exports.NonGrowableListView$ = NonGrowableListView$; | |
224 exports.UnmodifiableSetMixin$ = UnmodifiableSetMixin$; | |
225 exports.UnmodifiableSetMixin = UnmodifiableSetMixin; | |
226 exports.UnmodifiableSetView$ = UnmodifiableSetView$; | |
227 exports.UnmodifiableMapMixin$ = UnmodifiableMapMixin$; | |
228 exports.UnmodifiableMapMixin = UnmodifiableMapMixin; | |
229 }); | |
OLD | NEW |