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 source_span.location_mixin; | |
6 | |
7 import 'location.dart'; | 5 import 'location.dart'; |
8 import 'span.dart'; | 6 import 'span.dart'; |
9 | 7 |
10 // Note: this class duplicates a lot of functionality of [SourceLocation]. This | 8 // Note: this class duplicates a lot of functionality of [SourceLocation]. This |
11 // is because in order for SourceLocation to use SourceLocationMixin, | 9 // is because in order for SourceLocation to use SourceLocationMixin, |
12 // SourceLocationMixin couldn't implement SourceLocation. In SourceSpan we | 10 // SourceLocationMixin couldn't implement SourceLocation. In SourceSpan we |
13 // handle this by making the class itself non-extensible, but that would be a | 11 // handle this by making the class itself non-extensible, but that would be a |
14 // breaking change for SourceLocation. So until we want to endure the pain of | 12 // breaking change for SourceLocation. So until we want to endure the pain of |
15 // cutting a release with breaking changes, we duplicate the code here. | 13 // cutting a release with breaking changes, we duplicate the code here. |
16 | 14 |
(...skipping 25 matching lines...) Loading... |
42 bool operator ==(other) => | 40 bool operator ==(other) => |
43 other is SourceLocation && | 41 other is SourceLocation && |
44 sourceUrl == other.sourceUrl && | 42 sourceUrl == other.sourceUrl && |
45 offset == other.offset; | 43 offset == other.offset; |
46 | 44 |
47 int get hashCode => sourceUrl.hashCode + offset; | 45 int get hashCode => sourceUrl.hashCode + offset; |
48 | 46 |
49 String toString() => '<$runtimeType: $offset $toolString>'; | 47 String toString() => '<$runtimeType: $offset $toolString>'; |
50 } | 48 } |
51 | 49 |
OLD | NEW |