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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/parameter_stub_generator.dart

Issue 1318383002: Extract ReceiverMask interface from TypeMask. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 class ParameterStubGenerator { 7 class ParameterStubGenerator {
8 static final Set<Selector> emptySelectorSet = new Set<Selector>(); 8 static final Set<Selector> emptySelectorSet = new Set<Selector>();
9 9
10 final Namer namer; 10 final Namer namer;
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 compiler.internalError(cls.methodElement, 'Bound closure1.'); 193 compiler.internalError(cls.methodElement, 'Bound closure1.');
194 } 194 }
195 if (cls.methodElement.isInstanceMember) { 195 if (cls.methodElement.isInstanceMember) {
196 compiler.internalError(cls.methodElement, 'Bound closure2.'); 196 compiler.internalError(cls.methodElement, 'Bound closure2.');
197 } 197 }
198 } 198 }
199 199
200 // The set of selectors that apply to `member`. For example, for 200 // The set of selectors that apply to `member`. For example, for
201 // a member `foo(x, [y])` the following selectors may apply: 201 // a member `foo(x, [y])` the following selectors may apply:
202 // `foo(x)`, and `foo(x, y)`. 202 // `foo(x)`, and `foo(x, y)`.
203 Map<Selector, TypeMaskSet> selectors; 203 Map<Selector, ReceiverMaskSet> selectors;
204 // The set of selectors that apply to `member` if it's name was `call`. 204 // The set of selectors that apply to `member` if it's name was `call`.
205 // This happens when a member is torn off. In that case calls to the 205 // This happens when a member is torn off. In that case calls to the
206 // function use the name `call`, and we must be able to handle every 206 // function use the name `call`, and we must be able to handle every
207 // `call` invocation that matches the signature. For example, for 207 // `call` invocation that matches the signature. For example, for
208 // a member `foo(x, [y])` the following selectors would be possible 208 // a member `foo(x, [y])` the following selectors would be possible
209 // call-selectors: `call(x)`, and `call(x, y)`. 209 // call-selectors: `call(x)`, and `call(x, y)`.
210 Map<Selector, TypeMaskSet> callSelectors; 210 Map<Selector, ReceiverMaskSet> callSelectors;
211 211
212 // Only instance members (not static methods) need stubs. 212 // Only instance members (not static methods) need stubs.
213 if (member.isInstanceMember) { 213 if (member.isInstanceMember) {
214 selectors = compiler.codegenWorld.invocationsByName(member.name); 214 selectors = compiler.codegenWorld.invocationsByName(member.name);
215 } 215 }
216 216
217 if (canTearOff) { 217 if (canTearOff) {
218 String call = namer.closureInvocationSelectorName; 218 String call = namer.closureInvocationSelectorName;
219 callSelectors = compiler.codegenWorld.invocationsByName(call); 219 callSelectors = compiler.codegenWorld.invocationsByName(call);
220 } 220 }
221 221
222 assert(emptySelectorSet.isEmpty); 222 assert(emptySelectorSet.isEmpty);
223 if (selectors == null) selectors = const <Selector, TypeMaskSet>{}; 223 if (selectors == null) selectors = const <Selector, ReceiverMaskSet>{};
224 if (callSelectors == null) callSelectors = const <Selector, TypeMaskSet>{}; 224 if (callSelectors == null) callSelectors = const <Selector, ReceiverMaskSet> {};
Siggi Cherem (dart-lang) 2015/09/01 02:12:59 nit: wrap
Johnni Winther 2015/09/01 08:15:51 Done.
225 225
226 List<ParameterStubMethod> stubs = <ParameterStubMethod>[]; 226 List<ParameterStubMethod> stubs = <ParameterStubMethod>[];
227 227
228 if (selectors.isEmpty && callSelectors.isEmpty) { 228 if (selectors.isEmpty && callSelectors.isEmpty) {
229 return stubs; 229 return stubs;
230 } 230 }
231 231
232 // For every call-selector the corresponding selector with the name of the 232 // For every call-selector the corresponding selector with the name of the
233 // member. 233 // member.
234 // 234 //
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 generateParameterStub(member, selector, null); 274 generateParameterStub(member, selector, null);
275 if (stub != null) { 275 if (stub != null) {
276 stubs.add(stub); 276 stubs.add(stub);
277 } 277 }
278 } 278 }
279 } 279 }
280 280
281 return stubs; 281 return stubs;
282 } 282 }
283 } 283 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698