| Index: pkg/compiler/lib/src/js_emitter/program_builder.dart
|
| diff --git a/pkg/compiler/lib/src/js_emitter/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder.dart
|
| index 01c38363c652c425b6f3f54251a396ed2a68a335..6bd551b25f4f9970018100f78c61550d6613e4f0 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/program_builder.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/program_builder.dart
|
| @@ -19,6 +19,7 @@ import 'js_emitter.dart' show
|
| ClassStubGenerator,
|
| CodeEmitterTask,
|
| InterceptorStubGenerator,
|
| + ParameterStubGenerator,
|
| TypeTestGenerator,
|
| TypeTestProperties;
|
|
|
| @@ -424,7 +425,6 @@ class ProgramBuilder {
|
| bool isClosure = false;
|
| bool isNotApplyTarget = !element.isFunction || element.isAccessor;
|
|
|
| - final bool needsStubs = _methodNeedsStubs(element);
|
| final bool canBeReflected = _methodCanBeReflected(element);
|
| final bool canBeApplied = _methodCanBeApplied(element);
|
| final bool hasSuperAlias = backend.isAliasedSuperMember(element);
|
| @@ -454,7 +454,27 @@ class ProgramBuilder {
|
| return new InstanceMethod(element, name, code, needsTearOff: canTearOff,
|
| tearOffName: tearOffName, isClosure: isClosure,
|
| hasSuperAlias: hasSuperAlias, canBeApplied: canBeApplied,
|
| - canBeReflected: canBeReflected, needsStubs: needsStubs);
|
| + canBeReflected: canBeReflected,
|
| + parameterStubs: _generateParameterStubs(element, canTearOff));
|
| + }
|
| +
|
| + List<ParameterStubMethod> _generateParameterStubs(FunctionElement element,
|
| + bool canTearOff) {
|
| + List<ParameterStubMethod> parameterStubs = <ParameterStubMethod>[];
|
| + if (_methodNeedsStubs(element)) {
|
| + ParameterStubGenerator generator =
|
| + new ParameterStubGenerator(_compiler, namer, backend);
|
| + Map<Selector, js.Expression> parameterStubsForElement =
|
| + generator.generateParameterStubs(element, canTearOff);
|
| + parameterStubsForElement.forEach((Selector selector,
|
| + js.Expression code) {
|
| + String name = namer.invocationName(selector);
|
| + parameterStubs.add(
|
| + _buildParameterStubMethod(name, code, selector,
|
| + element: element));
|
| + });
|
| + }
|
| + return parameterStubs;
|
| }
|
|
|
| /// Builds a stub method.
|
| @@ -466,6 +486,12 @@ class ProgramBuilder {
|
| return new StubMethod(name, code, element: element);
|
| }
|
|
|
| + Method _buildParameterStubMethod(String name, js.Expression code,
|
| + Selector selector,
|
| + {Element element}) {
|
| + return new ParameterStubMethod(name, code, selector, element: element);
|
| + }
|
| +
|
| // The getInterceptor methods directly access the prototype of classes.
|
| // We must evaluate these classes eagerly so that the prototype is
|
| // accessible.
|
| @@ -563,7 +589,6 @@ class ProgramBuilder {
|
| js.Expression code = backend.generatedCode[element];
|
|
|
| final bool isNotApplyTarget = !element.isConstructor && !element.isAccessor;
|
| - final bool needsStubs = _methodNeedsStubs(element);
|
| final bool canBeApplied = _methodCanBeApplied(element);
|
| final bool canBeReflected = _methodCanBeReflected(element);
|
|
|
| @@ -579,7 +604,9 @@ class ProgramBuilder {
|
| tearOffName: tearOffName,
|
| canBeApplied: canBeApplied,
|
| canBeReflected: canBeReflected,
|
| - needsStubs: needsStubs);
|
| + parameterStubs:
|
| + _generateParameterStubs(element,
|
| + needsTearOff));
|
| }
|
|
|
| void _registerConstants(OutputUnit outputUnit,
|
|
|