diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart index 95197e6455a..c5188fcd1d0 100644 --- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart +++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart @@ -1477,12 +1477,18 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { FunctionSignature functionSignature = body.computeSignature(compiler); + // Provide the parameters to the generative constructor body. functionSignature.orderedForEachParameter((parameter) { - // if [parameter] is boxed, it will be a field in the box passed as the - // last parameter. So no need to direclty pass it. + // If [parameter] is boxed, it will be a field in the box passed as the + // last parameter. So no need to directly pass it. if (!localsHandler.isBoxed(parameter)) { bodyCallInputs.add(localsHandler.readLocal(parameter)); } + }); + + // Provide the parameter checks to the generative constructor + // body. + functionSignature.orderedForEachParameter((parameter) { // If [parameter] is checked, we pass the already computed // boolean to the constructor body. if (elements.isParameterChecked(parameter)) { diff --git a/tests/language/argument_definition6_test.dart b/tests/language/argument_definition6_test.dart new file mode 100644 index 00000000000..5dc87483ad9 --- /dev/null +++ b/tests/language/argument_definition6_test.dart @@ -0,0 +1,26 @@ +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +// for details. All rights reserved. Use of this source code is governed by a +// BSD-style license that can be found in the LICENSE file. + +// Regression test for +// https://code.google.com/p/dart/issues/detail?id=9090. +// Parameters used to be passed in the wrong order in a constructor in the +// presence of parameter checks. + + +class A { + A(expect1, expect2, value1, value2, {layers, serviceUrl}) { + Expect.equals(expect1, ?layers); + Expect.equals(expect2, ?serviceUrl); + Expect.equals(value1, layers); + Expect.equals(value2, serviceUrl); + } +} + +main() { + new A(false, false, null, null); + new A(true, false, 42, null, layers: 42); + new A(false, true, null, 43, serviceUrl: 43); + new A(true, true, 42, 43, layers: 42, serviceUrl: 43); + new A(true, true, 42, 43, serviceUrl: 43, layers: 42); +}