Patch to add some dynamic behavior. For the previous change, see
R=whesse@google.com https://codereview.chromium.org/3001433002 Review-Url: https://codereview.chromium.org/2996833002 .
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
// Copyright (c) 2012, 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.
|
||||
|
||||
// Test that a parameter used in two different closures defined in a
|
||||
// constructor initializer, is properly boxed.
|
||||
|
||||
import "package:expect/expect.dart";
|
||||
|
||||
class A {
|
||||
var f;
|
||||
var g;
|
||||
A(a)
|
||||
: f = (() => 42 + a),
|
||||
g = (() => ++a) {
|
||||
a = 4;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
var h;
|
||||
C(a)
|
||||
: h = (() => ++a),
|
||||
super(42);
|
||||
}
|
||||
|
||||
main() {
|
||||
var a = new A(1);
|
||||
a = new B(0);
|
||||
var ah = /*@compile-error=unspecified*/ a.h();
|
||||
}
|
||||
@@ -29,7 +29,7 @@ class C extends A {
|
||||
}
|
||||
|
||||
main() {
|
||||
var a = new A(1);
|
||||
dynamic a = new A(1);
|
||||
Expect.equals(46, a.f());
|
||||
Expect.equals(5, a.g());
|
||||
Expect.equals(47, a.f());
|
||||
@@ -43,6 +43,8 @@ main() {
|
||||
Expect.equals(46, a.f());
|
||||
Expect.equals(5, a.g());
|
||||
Expect.equals(47, a.f());
|
||||
Expect.equals(1, a.h());
|
||||
Expect.equals(2, a.h());
|
||||
Expect.equals(47, a.f());
|
||||
Expect.equals(6, a.g());
|
||||
Expect.equals(48, a.f());
|
||||
|
||||
@@ -22,4 +22,3 @@ cha_deopt3_test: Crash # Requires deferred libraries
|
||||
class_literal_static_test: SkipByDesign # Requires strong mode
|
||||
class_override_test: SkipByDesign # Requires strong mode
|
||||
closure_internals_test: SkipByDesign # Requires strong mode
|
||||
closure_in_initializer_static_test: SkipByDesign # Requires strong mode
|
||||
Reference in New Issue
Block a user