| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 sourcemap.output_structure; | 5 library sourcemap.output_structure; |
| 6 | 6 |
| 7 import 'dart:math' as Math; | 7 import 'dart:math' as Math; |
| 8 import 'html_parts.dart' show Annotation, CodeLine, JsonStrategy; | 8 import 'html_parts.dart' show Annotation, CodeLine, JsonStrategy; |
| 9 | 9 |
| 10 // Constants used to identify the subsection of the JavaScript output. These | 10 // Constants used to identify the subsection of the JavaScript output. These |
| (...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 return new Interval(Math.min(from, index), Math.max(to, index + 1)); | 630 return new Interval(Math.min(from, index), Math.max(to, index + 1)); |
| 631 } | 631 } |
| 632 | 632 |
| 633 bool inWindow(int index, {int windowSize: 0}) { | 633 bool inWindow(int index, {int windowSize: 0}) { |
| 634 return from - windowSize <= index && index < to + windowSize; | 634 return from - windowSize <= index && index < to + windowSize; |
| 635 } | 635 } |
| 636 | 636 |
| 637 String toString() => '[$from,$to['; | 637 String toString() => '[$from,$to['; |
| 638 } | 638 } |
| 639 | 639 |
| 640 enum CodeKind { LIBRARY, CLASS, MEMBER, } | 640 enum CodeKind { |
| 641 LIBRARY, |
| 642 CLASS, |
| 643 MEMBER, |
| 644 } |
| 641 | 645 |
| 642 class CodeLocation { | 646 class CodeLocation { |
| 643 final Uri uri; | 647 final Uri uri; |
| 644 final String name; | 648 final String name; |
| 645 final int offset; | 649 final int offset; |
| 646 | 650 |
| 647 CodeLocation(this.uri, this.name, this.offset); | 651 CodeLocation(this.uri, this.name, this.offset); |
| 648 | 652 |
| 649 String toString() => '$uri:$name:$offset'; | 653 String toString() => '$uri:$name:$offset'; |
| 650 | 654 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 } | 709 } |
| 706 | 710 |
| 707 static CodeSource fromJson(Map json) { | 711 static CodeSource fromJson(Map json) { |
| 708 if (json == null) return null; | 712 if (json == null) return null; |
| 709 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']], | 713 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']], |
| 710 Uri.parse(json['uri']), json['name'], json['begin'], json['end']); | 714 Uri.parse(json['uri']), json['name'], json['begin'], json['end']); |
| 711 json['members'].forEach((m) => codeSource.members.add(fromJson(m))); | 715 json['members'].forEach((m) => codeSource.members.add(fromJson(m))); |
| 712 return codeSource; | 716 return codeSource; |
| 713 } | 717 } |
| 714 } | 718 } |
| OLD | NEW |