OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
5 import "package:expect/expect.dart"; | |
6 | |
7 // Test cascades, issues 7494 (vm), 7689 (dart2js). | 5 // Test cascades, issues 7494 (vm), 7689 (dart2js). |
8 | 6 |
9 main() { | 7 main() { |
10 var a = new Element(null); | 8 var a = new Element(null); |
11 Expect.equals(1, a.path0.length); | 9 Expect.equals(1, a.path0.length); |
12 Expect.equals(a, a.path0[0]); | 10 Expect.equals(a, a.path0[0]); |
13 | 11 |
14 // Issue 7693: e0 ? e1 : e2..f() parses as (e0 ? e1 : e2)..f(). | 12 // Issue 7693: e0 ? e1 : e2..f() parses as (e0 ? e1 : e2)..f(). |
15 Expect.equals(2, a.path1.length); | 13 Expect.equals(2, a.path1.length); |
16 Expect.equals(a, a.path1[0]); | 14 Expect.equals(a, a.path1[0]); |
(...skipping 29 matching lines...) Expand all Loading... |
46 } | 44 } |
47 | 45 |
48 List<Element> get path1 { | 46 List<Element> get path1 { |
49 return (parent == null) ? <Element>[this] : parent.path1..add(this); | 47 return (parent == null) ? <Element>[this] : parent.path1..add(this); |
50 } | 48 } |
51 | 49 |
52 List<Element> get path2 { | 50 List<Element> get path2 { |
53 return (parent == null) ? <Element>[this] : (parent.path2..add(this)); | 51 return (parent == null) ? <Element>[this] : (parent.path2..add(this)); |
54 } | 52 } |
55 } | 53 } |
OLD | NEW |