| Index: dart/frog/leg/resolver.dart
|
| diff --git a/dart/frog/leg/resolver.dart b/dart/frog/leg/resolver.dart
|
| index db1a755a6da2ba991350c1ddcbccdb723e8d0f04..ca3edcd9c99772c1a531b2471ff795e6ef83785d 100644
|
| --- a/dart/frog/leg/resolver.dart
|
| +++ b/dart/frog/leg/resolver.dart
|
| @@ -70,13 +70,9 @@ class ResolverTask extends CompilerTask {
|
| [noConstructor(Element)]) {
|
| final SourceString constructorName = getConstructorName(send);
|
| final SourceString className = classElement.name;
|
| - FunctionElement result = classElement.lookupConstructor(className,
|
| - constructorName,
|
| - noConstructor);
|
| - if (result === null && send.arguments.isEmpty()) {
|
| - result = classElement.getSynthesizedConstructor();
|
| - }
|
| - return result;
|
| + return classElement.lookupConstructor(className,
|
| + constructorName,
|
| + noConstructor);
|
| }
|
|
|
| FunctionElement resolveConstructorRedirection(FunctionElement constructor) {
|
| @@ -182,13 +178,6 @@ class ResolverTask extends CompilerTask {
|
| defaultClass.name.slowToString()));
|
| constructor.defaultImplementation = defaultClass.lookupConstructor(name);
|
|
|
| - if (constructor.defaultImplementation === null
|
| - && name == defaultClass.name
|
| - && constructor.computeParameters(compiler).parameterCount === 0) {
|
| - constructor.defaultImplementation =
|
| - defaultClass.getSynthesizedConstructor();
|
| - }
|
| -
|
| if (constructor.defaultImplementation === null) {
|
| // We failed find a constrcutor named either
|
| // "MyInterface.name" or "MyClass.name".
|
| @@ -1201,6 +1190,23 @@ class ClassResolverVisitor extends CommonResolverVisitor<Type> {
|
| link = link.tail) {
|
| element.interfaces = element.interfaces.prepend(visit(link.head));
|
| }
|
| +
|
| + if (element.constructors.length == 0) {
|
| + // Add a synthetic nullary constructor if there are no other
|
| + // constructors.
|
| + SynthesizedConstructorElement constructor =
|
| + new SynthesizedConstructorElement(element);
|
| + element.constructors[element.name] = constructor;
|
| + Type returnType = compiler.types.voidType;
|
| + constructor.type = new FunctionType(returnType, const EmptyLink<Type>(),
|
| + constructor);
|
| + constructor.cachedNode =
|
| + new FunctionExpression(new Identifier(element.position()),
|
| + new NodeList.empty(),
|
| + new Block(new NodeList.empty()),
|
| + null, null, null, null);
|
| + }
|
| +
|
| return element.computeType(compiler);
|
| }
|
|
|
| @@ -1444,12 +1450,7 @@ class ConstructorResolver extends CommonResolverVisitor<Element> {
|
| if (cls.isInterface() && (cls.defaultClass === null)) {
|
| error(selector, MessageKind.CANNOT_INSTANTIATE_INTERFACE, [cls.name]);
|
| }
|
| - FunctionElement constructor = cls.lookupConstructor(cls.name);
|
| - if (constructor === null && node.send.argumentsNode.isEmpty()) {
|
| - e = cls.getSynthesizedConstructor();
|
| - } else {
|
| - e = constructor;
|
| - }
|
| + e = cls.lookupConstructor(cls.name);
|
| }
|
| return e;
|
| }
|
|
|