| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2016, 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.md file. | |
| 4 | |
| 5 // Parse error: but the parser should recover and create something that looks | |
| 6 // like `a b(c) => d`. | |
| 7 a b(c) = d; | |
| 8 | |
| 9 class C { | |
| 10 // Good constructor. | |
| 11 const C.constant(); | |
| 12 | |
| 13 // Bad constructor: missing factory keyword (and additional formals). | |
| 14 C.missingFactoryKeyword() = C.constant; | |
| 15 | |
| 16 // Good redirecting const factory constructor. | |
| 17 const factory C.good() = C.constant; | |
| 18 | |
| 19 // Parse error, the parser should recover and create a redirecting factory | |
| 20 // constructor body. | |
| 21 C notEvenAConstructor(a) = h; | |
| 22 } | |
| 23 | |
| 24 main() { | |
| 25 C c = null; | |
| 26 print(const C.constant()); | |
| 27 print(const C.missingFactoryKeyword()); | |
| 28 print(const C.good()); | |
| 29 print(new C.constant().notEvenAConstructor(null)); | |
| 30 } | |
| OLD | NEW |