OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library link_helper; | 5 library link_helper; |
6 | 6 |
7 import 'package:compiler/implementation/util/util.dart'; | 7 import 'package:compiler/src/util/util.dart'; |
8 import 'package:compiler/implementation/util/util_implementation.dart'; | 8 import 'package:compiler/src/util/util_implementation.dart'; |
9 | 9 |
10 Link LinkFromList(List list) { | 10 Link LinkFromList(List list) { |
11 switch (list.length) { | 11 switch (list.length) { |
12 case 0: | 12 case 0: |
13 return new Link(); | 13 return new Link(); |
14 case 1: | 14 case 1: |
15 return new LinkEntry(list[0]); | 15 return new LinkEntry(list[0]); |
16 case 2: | 16 case 2: |
17 return new LinkEntry(list[0], new LinkEntry(list[1])); | 17 return new LinkEntry(list[0], new LinkEntry(list[1])); |
18 case 3: | 18 case 3: |
19 return new LinkEntry( | 19 return new LinkEntry( |
20 list[0], new LinkEntry(list[1], new LinkEntry(list[2]))); | 20 list[0], new LinkEntry(list[1], new LinkEntry(list[2]))); |
21 } | 21 } |
22 Link link = new Link(); | 22 Link link = new Link(); |
23 for (int i = list.length; i > 0; i--) { | 23 for (int i = list.length; i > 0; i--) { |
24 link = link.prepend(list[i - 1]); | 24 link = link.prepend(list[i - 1]); |
25 } | 25 } |
26 return link; | 26 return link; |
27 } | 27 } |
OLD | NEW |