OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 test.backend.platform_selector.ast; | |
6 | |
7 import 'package:source_span/source_span.dart'; | 5 import 'package:source_span/source_span.dart'; |
8 | 6 |
9 import 'visitor.dart'; | 7 import 'visitor.dart'; |
10 | 8 |
11 /// The superclass of nodes in the platform selector abstract syntax tree. | 9 /// The superclass of nodes in the platform selector abstract syntax tree. |
12 abstract class Node { | 10 abstract class Node { |
13 /// The span indicating where this node came from. | 11 /// The span indicating where this node came from. |
14 /// | 12 /// |
15 /// This is a [FileSpan] because the nodes are parsed from a single continuous | 13 /// This is a [FileSpan] because the nodes are parsed from a single continuous |
16 /// string, but the string itself isn't actually a file. It might come from a | 14 /// string, but the string itself isn't actually a file. It might come from a |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 } | 128 } |
131 } | 129 } |
132 | 130 |
133 /// Like [FileSpan.expand], except if [start] and [end] are `null` or from | 131 /// Like [FileSpan.expand], except if [start] and [end] are `null` or from |
134 /// different files it returns `null` rather than throwing an error. | 132 /// different files it returns `null` rather than throwing an error. |
135 FileSpan _expandSafe(FileSpan start, FileSpan end) { | 133 FileSpan _expandSafe(FileSpan start, FileSpan end) { |
136 if (start == null || end == null) return null; | 134 if (start == null || end == null) return null; |
137 if (start.file != end.file) return null; | 135 if (start.file != end.file) return null; |
138 return start.expand(end); | 136 return start.expand(end); |
139 } | 137 } |
OLD | NEW |