Fix bug 9090: provide the paramter checks arguments to the generative constructor body after the regular arguments.

Review URL: https://codereview.chromium.org//12544021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19916 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ngeoffray@google.com
2013-03-13 09:55:46 +00:00
parent 10af8725ab
commit de312cd402
2 changed files with 34 additions and 2 deletions
@@ -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)) {
@@ -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);
}