| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 library link_helper; |
| 6 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/util/util_implementat
ion.dart'; |
| 8 |
| 9 Link LinkFromList(List list) { |
| 10 switch (list.length) { |
| 11 case 0: |
| 12 return new Link(); |
| 13 case 1: |
| 14 return new LinkEntry(list[0]); |
| 15 case 2: |
| 16 return new LinkEntry(list[0], new LinkEntry(list[1])); |
| 17 case 3: |
| 18 return new LinkEntry( |
| 19 list[0], new LinkEntry(list[1], new LinkEntry(list[2]))); |
| 20 } |
| 21 Link link = new Link(); |
| 22 for (int i = list.length; i > 0; i--) { |
| 23 link = link.prepend(list[i - 1]); |
| 24 } |
| 25 return link; |
| 26 } |
| OLD | NEW |