Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: dart/tests/language/src/ConstructorRedirectTest.dart

Issue 9663065: Fix ConstructorRedirectTest. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add commetn Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dart/tests/language/language-leg.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Dart test program for redirection constructors. 4 // Dart test program for redirection constructors.
5 5
6 class A { 6 class A {
7 var x; 7 var x;
8 A(this.x) {} 8 A(this.x) {}
9 A.named(x, int y) : this(x + y); 9 A.named(x, int y) : this(x + y);
10 A.named2(int x, int y, z) : this.named(staticFun(x, y), z); 10 A.named2(int x, int y, z) : this.named(staticFun(x, y), z);
11 11
12 // The following is a bit tricky. It is a compile-time error to
13 // refer to this (implicitly or explicitly) from an initializer.
14 // When we remove the line with moreStaticFun, staticFun is really a
15 // static function and it is legal to call it. This is what will
16 // happen in the /none version of this test. However, in /01,
17 // staticFun isn't really a static function and should cause a
18 // compile-time error.
19 static
20 moreStaticFun() {} /// 01: compile-time error
12 int staticFun(int v1, int v2) { 21 int staticFun(int v1, int v2) {
13 return v1 * v2; 22 return v1 * v2;
14 } 23 }
15 } 24 }
16 25
17 class B extends A { 26 class B extends A {
18 B(y) : super(y + 1) {} 27 B(y) : super(y + 1) {}
19 B.named(y) : super.named(y, y + 1) {} 28 B.named(y) : super.named(y, y + 1) {}
20 } 29 }
21 30
(...skipping 30 matching lines...) Expand all
52 D d = const D(498); 61 D d = const D(498);
53 Expect.equals(499, d.x); 62 Expect.equals(499, d.x);
54 d = const D.named(249); 63 d = const D.named(249);
55 Expect.equals(499, d.x); 64 Expect.equals(499, d.x);
56 } 65 }
57 } 66 }
58 67
59 main() { 68 main() {
60 ConstructorRedirectTest.testMain(); 69 ConstructorRedirectTest.testMain();
61 } 70 }
OLDNEW
« no previous file with comments | « dart/tests/language/language-leg.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698