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 { | 640 enum CodeKind { LIBRARY, CLASS, MEMBER, } |
641 LIBRARY, | |
642 CLASS, | |
643 MEMBER, | |
644 } | |
645 | 641 |
646 class CodeLocation { | 642 class CodeLocation { |
647 final Uri uri; | 643 final Uri uri; |
648 final String name; | 644 final String name; |
649 final int offset; | 645 final int offset; |
650 | 646 |
651 CodeLocation(this.uri, this.name, this.offset); | 647 CodeLocation(this.uri, this.name, this.offset); |
652 | 648 |
653 String toString() => '$uri:$name:$offset'; | 649 String toString() => '$uri:$name:$offset'; |
654 | 650 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 } | 705 } |
710 | 706 |
711 static CodeSource fromJson(Map json) { | 707 static CodeSource fromJson(Map json) { |
712 if (json == null) return null; | 708 if (json == null) return null; |
713 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']], | 709 CodeSource codeSource = new CodeSource(CodeKind.values[json['kind']], |
714 Uri.parse(json['uri']), json['name'], json['begin'], json['end']); | 710 Uri.parse(json['uri']), json['name'], json['begin'], json['end']); |
715 json['members'].forEach((m) => codeSource.members.add(fromJson(m))); | 711 json['members'].forEach((m) => codeSource.members.add(fromJson(m))); |
716 return codeSource; | 712 return codeSource; |
717 } | 713 } |
718 } | 714 } |
OLD | NEW |