| Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart
|
| diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
|
| index 3bd756da70c9e9cb7d42767af9f5a90dba996aa7..b2f28d02be128a17d755fde38a578af25902e6ff 100644
|
| --- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
|
| +++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
|
| @@ -752,7 +752,8 @@ class CodeGenerator extends GeneralizingAstVisitor
|
| var staticFields = <FieldDeclaration>[];
|
| var methods = <MethodDeclaration>[];
|
|
|
| - // True if a "call" method or getter exists.
|
| + // True if a "call" method or getter exists directly on this class.
|
| + // If so, we need to install a Function prototype.
|
| bool isCallable = false;
|
| for (var member in node.members) {
|
| if (member is ConstructorDeclaration) {
|
| @@ -780,6 +781,16 @@ class CodeGenerator extends GeneralizingAstVisitor
|
| }
|
| }
|
|
|
| + // True if a "call" method or getter exists directly or indirectly on this
|
| + // class. If so, we need special constructor handling.
|
| + bool isCallableTransitive =
|
| + classElem.lookUpMethod('call', currentLibrary) != null;
|
| + if (!isCallableTransitive) {
|
| + var callGetter = classElem.lookUpGetter('call', currentLibrary);
|
| + isCallableTransitive =
|
| + callGetter != null && callGetter.returnType is FunctionType;
|
| + }
|
| +
|
| JS.Expression className;
|
| if (classElem.typeParameters.isNotEmpty) {
|
| // Generic classes will be defined inside a function that closes over the
|
| @@ -816,7 +827,7 @@ class CodeGenerator extends GeneralizingAstVisitor
|
|
|
| _emitClassTypeTests(classElem, className, body);
|
|
|
| - _defineNamedConstructors(ctors, body, className, isCallable);
|
| + _defineNamedConstructors(ctors, body, className, isCallableTransitive);
|
| body.addAll(virtualFieldSymbols);
|
| _emitClassSignature(
|
| methods, allFields, classElem, ctors, extensions, className, body);
|
|
|