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

Side by Side Diff: tests/language/constructor_redirect2_test.dart

Issue 11293020: Redirecting constructor may not have function body (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « no previous file | tests/language/constructor_redirect3_negative_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
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.
4 // Redirection constructors must not have a function body.
5
6 class A {
7 var x;
8 A(this.x) {}
9
10 // Redirecting constructor must not have a function body.
11 A.illegalBody(x) : this(3) {} /// 01: compile-time error
12
13 // Redirecting constructor must not initialize any fields.
14 A.illegalInit() : this(3), x = 5; /// 02: compile-time error
15
16 // Redirecting constructor must not have initializing formal parameters.
17 A.illegalFormal(this.x) : this(3); /// 03: compile-time error
18
19 // Redirection constructors must not call super constructor.
20 A.illegalSuper() : this(3), super(3); /// 04: compile-time error
21 }
22
23 main() {
24 new A(3);
25 new A.illegalBody(10); /// 01: continued
26 new A.illegalInit(10); /// 02: continued
27 new A.illegalFormal(10); /// 03: continued
28 new A.illegalSuper(10); /// 04: continued
29 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/constructor_redirect3_negative_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698