| Index: compiler/java/com/google/dart/compiler/backend/js/Normalizer.java
|
| diff --git a/compiler/java/com/google/dart/compiler/backend/js/Normalizer.java b/compiler/java/com/google/dart/compiler/backend/js/Normalizer.java
|
| index 18947a9d5b8cc733ac2e3a07f31225e403fa512f..aca2528973da8e023849206dc7c7fb3058e2b6f3 100644
|
| --- a/compiler/java/com/google/dart/compiler/backend/js/Normalizer.java
|
| +++ b/compiler/java/com/google/dart/compiler/backend/js/Normalizer.java
|
| @@ -737,8 +737,24 @@ public class Normalizer {
|
| if (superLocator.needsSuperInvocation) {
|
| DartSuperConstructorInvocation superInvocation = new DartSuperConstructorInvocation(
|
| new DartIdentifier(""), Collections.<DartExpression>emptyList());
|
| - superInvocation.setSymbol(new SyntheticDefaultConstructorElement(null,
|
| - classElement.getSupertype().getElement(), null));
|
| + // Set constructor element - actual constructor with all named parameters or synthetic.
|
| + ConstructorElement superConstructorElement = null;
|
| + {
|
| + ClassElement superTypeElement = classElement.getSupertype().getElement();
|
| + List<ConstructorElement> constructors = superTypeElement.getConstructors();
|
| + for (ConstructorElement constructor : constructors) {
|
| + if (hasOnlyNamedParameters(constructor)) {
|
| + superConstructorElement = constructor;
|
| + break;
|
| + }
|
| + }
|
| + if (superConstructorElement == null) {
|
| + superConstructorElement =
|
| + new SyntheticDefaultConstructorElement(null, superTypeElement, null);
|
| + }
|
| + superInvocation.setSymbol(superConstructorElement);
|
| + }
|
| + // Add implicit "super" invocation.
|
| nInit.add(new DartInitializer(null, superInvocation));
|
| }
|
| }
|
| @@ -757,6 +773,18 @@ public class Normalizer {
|
| }
|
| }
|
|
|
| + /**
|
| + * @return <code>true</code> if given constructor has only named (i.e. optional) parameters.
|
| + */
|
| + private static boolean hasOnlyNamedParameters(ConstructorElement constructor) {
|
| + for (VariableElement parameter : constructor.getParameters()) {
|
| + if (!parameter.isNamed()) {
|
| + return false;
|
| + }
|
| + }
|
| + return true;
|
| + }
|
| +
|
| private DartExpression normalizeCompoundAssignment(Token operator,
|
| boolean isPostfix,
|
| DartExpression operand1,
|
|
|