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

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

Issue 2625713002: Rename Enqueuer.universe to worldBuilder. (Closed)
Patch Set: Updated cf. comments Created 3 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
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;
11 final Compiler compiler; 11 final Compiler compiler;
12 final JavaScriptBackend backend; 12 final JavaScriptBackend backend;
13 final ClosedWorld closedWorld; 13 final ClosedWorld closedWorld;
14 14
15 ParameterStubGenerator( 15 ParameterStubGenerator(
16 this.compiler, this.namer, this.backend, this.closedWorld); 16 this.compiler, this.namer, this.backend, this.closedWorld);
17 17
18 Emitter get emitter => backend.emitter.emitter; 18 Emitter get emitter => backend.emitter.emitter;
19 CodeEmitterTask get emitterTask => backend.emitter; 19 CodeEmitterTask get emitterTask => backend.emitter;
20 DiagnosticReporter get reporter => compiler.reporter; 20 DiagnosticReporter get reporter => compiler.reporter;
21 21
22 bool needsSuperGetter(FunctionElement element) => 22 bool needsSuperGetter(FunctionElement element) =>
23 compiler.codegenWorld.methodsNeedingSuperGetter.contains(element); 23 compiler.codegenWorldBuilder.methodsNeedingSuperGetter.contains(element);
24 24
25 /** 25 /**
26 * Generates stubs to handle invocation of methods with optional 26 * Generates stubs to handle invocation of methods with optional
27 * arguments. 27 * arguments.
28 * 28 *
29 * A method like `foo([x])` may be invoked by the following 29 * A method like `foo([x])` may be invoked by the following
30 * calls: `foo(), foo(1), foo(x: 1)`. This method generates the stub for the 30 * calls: `foo(), foo(1), foo(x: 1)`. This method generates the stub for the
31 * given [selector] and returns the generated [ParameterStubMethod]. 31 * given [selector] and returns the generated [ParameterStubMethod].
32 * 32 *
33 * Returns null if no stub is needed. 33 * Returns null if no stub is needed.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // The set of selectors that apply to `member` if it's name was `call`. 207 // The set of selectors that apply to `member` if it's name was `call`.
208 // This happens when a member is torn off. In that case calls to the 208 // This happens when a member is torn off. In that case calls to the
209 // function use the name `call`, and we must be able to handle every 209 // function use the name `call`, and we must be able to handle every
210 // `call` invocation that matches the signature. For example, for 210 // `call` invocation that matches the signature. For example, for
211 // a member `foo(x, [y])` the following selectors would be possible 211 // a member `foo(x, [y])` the following selectors would be possible
212 // call-selectors: `call(x)`, and `call(x, y)`. 212 // call-selectors: `call(x)`, and `call(x, y)`.
213 Map<Selector, SelectorConstraints> callSelectors; 213 Map<Selector, SelectorConstraints> callSelectors;
214 214
215 // Only instance members (not static methods) need stubs. 215 // Only instance members (not static methods) need stubs.
216 if (member.isInstanceMember) { 216 if (member.isInstanceMember) {
217 selectors = compiler.codegenWorld.invocationsByName(member.name); 217 selectors = compiler.codegenWorldBuilder.invocationsByName(member.name);
218 } 218 }
219 219
220 if (canTearOff) { 220 if (canTearOff) {
221 String call = namer.closureInvocationSelectorName; 221 String call = namer.closureInvocationSelectorName;
222 callSelectors = compiler.codegenWorld.invocationsByName(call); 222 callSelectors = compiler.codegenWorldBuilder.invocationsByName(call);
223 } 223 }
224 224
225 assert(emptySelectorSet.isEmpty); 225 assert(emptySelectorSet.isEmpty);
226 if (selectors == null) selectors = const <Selector, SelectorConstraints>{}; 226 if (selectors == null) selectors = const <Selector, SelectorConstraints>{};
227 if (callSelectors == null) 227 if (callSelectors == null)
228 callSelectors = const <Selector, SelectorConstraints>{}; 228 callSelectors = const <Selector, SelectorConstraints>{};
229 229
230 List<ParameterStubMethod> stubs = <ParameterStubMethod>[]; 230 List<ParameterStubMethod> stubs = <ParameterStubMethod>[];
231 231
232 if (selectors.isEmpty && callSelectors.isEmpty) { 232 if (selectors.isEmpty && callSelectors.isEmpty) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 generateParameterStub(member, selector, null); 278 generateParameterStub(member, selector, null);
279 if (stub != null) { 279 if (stub != null) {
280 stubs.add(stub); 280 stubs.add(stub);
281 } 281 }
282 } 282 }
283 } 283 }
284 284
285 return stubs; 285 return stubs;
286 } 286 }
287 } 287 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698