Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: pkg/analysis_server/lib/src/generated/service_computers.dart

Issue 250823006: Translate parts of engine.services project. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to pkg/analysis_services/ Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library service.computers; 8 library service.computers;
9 9
10 import 'package:analyzer/src/generated/java_core.dart' show JavaStringBuilder, S tringUtils; 10 import 'package:analyzer/src/generated/java_core.dart' show JavaStringBuilder, S tringUtils;
11 import 'package:analyzer/src/generated/java_engine.dart'; 11 import 'package:analyzer/src/generated/java_engine.dart';
12 import 'package:analyzer/src/generated/source.dart' show Source; 12 import 'package:analyzer/src/generated/source.dart' show Source;
13 import 'package:analyzer/src/generated/scanner.dart' show Token; 13 import 'package:analyzer/src/generated/scanner.dart' show Token;
14 import 'package:analyzer/src/generated/ast.dart'; 14 import 'package:analyzer/src/generated/ast.dart';
15 import 'package:analyzer/src/generated/element.dart'; 15 import 'package:analyzer/src/generated/element.dart';
16 import 'service_interfaces.dart'; 16 import 'service_interfaces.dart';
17 17
18 /** 18 /**
19 * A concrete implementation of [SourceRegion].
20 */
21 class SourceRegionImpl implements SourceRegion {
22 final int offset;
23
24 final int length;
25
26 SourceRegionImpl(this.offset, this.length);
27
28 @override
29 bool containsInclusive(int x) => offset <= x && x <= offset + length;
30
31 @override
32 bool operator ==(Object obj) {
33 if (identical(obj, this)) {
34 return true;
35 }
36 if (obj is! SourceRegion) {
37 return false;
38 }
39 SourceRegion other = obj as SourceRegion;
40 return other.offset == offset && other.length == length;
41 }
42
43 @override
44 int get hashCode => ObjectUtilities.combineHashCodes(offset, length);
45
46 @override
47 String toString() {
48 JavaStringBuilder builder = new JavaStringBuilder();
49 builder.append("[offset=");
50 builder.append(offset);
51 builder.append(", length=");
52 builder.append(length);
53 builder.append("]");
54 return builder.toString();
55 }
56 }
57
58 /**
59 * A concrete implementation of [Outline].
60 */
61 class OutlineImpl implements Outline {
62 final Outline parent;
63
64 final SourceRegion sourceRegion;
65
66 final OutlineKind kind;
67
68 final String name;
69
70 final int offset;
71
72 final int length;
73
74 final String parameters;
75
76 final String returnType;
77
78 final bool isAbstract;
79
80 final bool isStatic;
81
82 List<Outline> children = Outline.EMPTY_ARRAY;
83
84 OutlineImpl(this.parent, this.sourceRegion, this.kind, this.name, this.offset, this.length, this.parameters, this.returnType, this.isAbstract, this.isStatic);
85
86 @override
87 bool operator ==(Object obj) {
88 if (identical(obj, this)) {
89 return true;
90 }
91 if (obj is! OutlineImpl) {
92 return false;
93 }
94 OutlineImpl other = obj as OutlineImpl;
95 return (other.parent == parent) && other.offset == offset;
96 }
97
98 @override
99 int get hashCode => offset;
100
101 @override
102 bool get isPrivate => StringUtilities.startsWithChar(name, 0x5F);
103
104 @override
105 String toString() {
106 JavaStringBuilder builder = new JavaStringBuilder();
107 builder.append("[name=");
108 builder.append(name);
109 builder.append(", kind=");
110 builder.append(kind);
111 builder.append(", offset=");
112 builder.append(offset);
113 builder.append(", length=");
114 builder.append(length);
115 builder.append(", parameters=");
116 builder.append(parameters);
117 builder.append(", return=");
118 builder.append(returnType);
119 builder.append(", children=[");
120 builder.append(StringUtils.join(children, ", "));
121 builder.append("]]");
122 return builder.toString();
123 }
124 }
125
126 /**
127 * A concrete implementation of [HighlightRegion].
128 */
129 class HighlightRegionImpl extends SourceRegionImpl implements HighlightRegion {
130 final HighlightType type;
131
132 HighlightRegionImpl(int offset, int length, this.type) : super(offset, length) ;
133
134 @override
135 String toString() {
136 JavaStringBuilder builder = new JavaStringBuilder();
137 builder.append("[offset=");
138 builder.append(offset);
139 builder.append(", length=");
140 builder.append(length);
141 builder.append(", type=");
142 builder.append(type);
143 builder.append("]");
144 return builder.toString();
145 }
146 }
147
148 /**
149 * A computer for [NavigationRegion]s in a Dart [CompilationUnit].
150 */
151 class DartUnitNavigationComputer {
152 final CompilationUnit _unit;
153
154 List<NavigationRegion> _regions = [];
155
156 DartUnitNavigationComputer(this._unit);
157
158 /**
159 * Returns the computed [NavigationRegion]s, not `null`.
160 */
161 List<NavigationRegion> compute() {
162 _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this ));
163 return new List.from(_regions);
164 }
165
166 /**
167 * If the given [Element] is not `null`, then creates a corresponding
168 * [NavigationRegion].
169 */
170 void _addRegion(int offset, int length, Element element) {
171 NavigationTarget target = _createTarget(element);
172 if (target == null) {
173 return;
174 }
175 _regions.add(new NavigationRegionImpl(offset, length, <NavigationTarget> [ta rget]));
176 }
177
178 /**
179 * If the given [Element] is not `null`, then creates a corresponding
180 * [NavigationRegion].
181 */
182 void _addRegionForNode(AstNode node, Element element) {
183 int offset = node.offset;
184 int length = node.length;
185 _addRegion(offset, length, element);
186 }
187
188 /**
189 * If the given [Element] is not `null`, then creates a corresponding
190 * [NavigationRegion].
191 */
192 void _addRegionForToken(Token token, Element element) {
193 int offset = token.offset;
194 int length = token.length;
195 _addRegion(offset, length, element);
196 }
197
198 /**
199 * Returns the [NavigationTarget] for the given [Element], maybe `null` if
200 * `null` was given.
201 */
202 NavigationTarget _createTarget(Element element) {
203 if (element == null) {
204 return null;
205 }
206 if (element is FieldFormalParameterElement) {
207 element = (element as FieldFormalParameterElement).field;
208 }
209 return new NavigationTargetImpl(element.source, _getElementId(element), elem ent.nameOffset, element.displayName.length);
210 }
211
212 String _getElementId(Element element) => element.location.encoding;
213 }
214
215 class RecursiveAstVisitor_DartUnitNavigationComputer_compute extends RecursiveAs tVisitor<Object> {
216 final DartUnitNavigationComputer DartUnitNavigationComputer_this;
217
218 RecursiveAstVisitor_DartUnitNavigationComputer_compute(this.DartUnitNavigation Computer_this) : super();
219
220 @override
221 Object visitAssignmentExpression(AssignmentExpression node) {
222 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
223 return super.visitAssignmentExpression(node);
224 }
225
226 @override
227 Object visitBinaryExpression(BinaryExpression node) {
228 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
229 return super.visitBinaryExpression(node);
230 }
231
232 @override
233 Object visitIndexExpression(IndexExpression node) {
234 DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.b estElement);
235 return super.visitIndexExpression(node);
236 }
237
238 @override
239 Object visitPostfixExpression(PostfixExpression node) {
240 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
241 return super.visitPostfixExpression(node);
242 }
243
244 @override
245 Object visitPrefixExpression(PrefixExpression node) {
246 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
247 return super.visitPrefixExpression(node);
248 }
249
250 @override
251 Object visitSimpleIdentifier(SimpleIdentifier node) {
252 DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement);
253 return super.visitSimpleIdentifier(node);
254 }
255 }
256
257 /**
258 * A computer for [HighlightRegion]s in a Dart [CompilationUnit]. 19 * A computer for [HighlightRegion]s in a Dart [CompilationUnit].
259 */ 20 */
260 class DartUnitHighlightsComputer { 21 class DartUnitHighlightsComputer {
261 final CompilationUnit _unit; 22 final CompilationUnit _unit;
262 23
263 List<HighlightRegion> _regions = []; 24 List<HighlightRegion> _regions = [];
264 25
265 DartUnitHighlightsComputer(this._unit); 26 DartUnitHighlightsComputer(this._unit);
266 27
267 /** 28 /**
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 } 293 }
533 } 294 }
534 295
535 void _addRegion_tokenStart_tokenEnd(Token a, Token b, HighlightType type) { 296 void _addRegion_tokenStart_tokenEnd(Token a, Token b, HighlightType type) {
536 int offset = a.offset; 297 int offset = a.offset;
537 int end = b.end; 298 int end = b.end;
538 _addRegion(offset, end - offset, type); 299 _addRegion(offset, end - offset, type);
539 } 300 }
540 } 301 }
541 302
542 class RecursiveAstVisitor_DartUnitHighlightsComputer_compute extends RecursiveAs tVisitor<Object> {
543 final DartUnitHighlightsComputer DartUnitHighlightsComputer_this;
544
545 RecursiveAstVisitor_DartUnitHighlightsComputer_compute(this.DartUnitHighlights Computer_this) : super();
546
547 @override
548 Object visitAnnotation(Annotation node) {
549 DartUnitHighlightsComputer_this._addIdentifierRegion_annotation(node);
550 return super.visitAnnotation(node);
551 }
552
553 @override
554 Object visitAsExpression(AsExpression node) {
555 DartUnitHighlightsComputer_this._addRegion_token(node.asOperator, HighlightT ype.BUILT_IN);
556 return super.visitAsExpression(node);
557 }
558
559 @override
560 Object visitBooleanLiteral(BooleanLiteral node) {
561 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ BOOLEAN);
562 return super.visitBooleanLiteral(node);
563 }
564
565 @override
566 Object visitCatchClause(CatchClause node) {
567 DartUnitHighlightsComputer_this._addRegion_token(node.onKeyword, HighlightTy pe.BUILT_IN);
568 return super.visitCatchClause(node);
569 }
570
571 @override
572 Object visitClassDeclaration(ClassDeclaration node) {
573 DartUnitHighlightsComputer_this._addRegion_token(node.abstractKeyword, Highl ightType.BUILT_IN);
574 return super.visitClassDeclaration(node);
575 }
576
577 @override
578 Object visitConstructorDeclaration(ConstructorDeclaration node) {
579 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
580 DartUnitHighlightsComputer_this._addRegion_token(node.factoryKeyword, Highli ghtType.BUILT_IN);
581 return super.visitConstructorDeclaration(node);
582 }
583
584 @override
585 Object visitDoubleLiteral(DoubleLiteral node) {
586 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ DOUBLE);
587 return super.visitDoubleLiteral(node);
588 }
589
590 @override
591 Object visitExportDirective(ExportDirective node) {
592 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
593 return super.visitExportDirective(node);
594 }
595
596 @override
597 Object visitFieldDeclaration(FieldDeclaration node) {
598 DartUnitHighlightsComputer_this._addRegion_token(node.staticKeyword, Highlig htType.BUILT_IN);
599 return super.visitFieldDeclaration(node);
600 }
601
602 @override
603 Object visitFunctionDeclaration(FunctionDeclaration node) {
604 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
605 DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, Highl ightType.BUILT_IN);
606 return super.visitFunctionDeclaration(node);
607 }
608
609 @override
610 Object visitFunctionTypeAlias(FunctionTypeAlias node) {
611 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
612 return super.visitFunctionTypeAlias(node);
613 }
614
615 @override
616 Object visitHideCombinator(HideCombinator node) {
617 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
618 return super.visitHideCombinator(node);
619 }
620
621 @override
622 Object visitImplementsClause(ImplementsClause node) {
623 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
624 return super.visitImplementsClause(node);
625 }
626
627 @override
628 Object visitImportDirective(ImportDirective node) {
629 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
630 DartUnitHighlightsComputer_this._addRegion_token(node.deferredToken, Highlig htType.BUILT_IN);
631 DartUnitHighlightsComputer_this._addRegion_token(node.asToken, HighlightType .BUILT_IN);
632 return super.visitImportDirective(node);
633 }
634
635 @override
636 Object visitIntegerLiteral(IntegerLiteral node) {
637 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ INTEGER);
638 return super.visitIntegerLiteral(node);
639 }
640
641 @override
642 Object visitLibraryDirective(LibraryDirective node) {
643 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
644 return super.visitLibraryDirective(node);
645 }
646
647 @override
648 Object visitMethodDeclaration(MethodDeclaration node) {
649 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
650 DartUnitHighlightsComputer_this._addRegion_token(node.modifierKeyword, Highl ightType.BUILT_IN);
651 DartUnitHighlightsComputer_this._addRegion_token(node.operatorKeyword, Highl ightType.BUILT_IN);
652 DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, Highl ightType.BUILT_IN);
653 return super.visitMethodDeclaration(node);
654 }
655
656 @override
657 Object visitNativeClause(NativeClause node) {
658 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
659 return super.visitNativeClause(node);
660 }
661
662 @override
663 Object visitNativeFunctionBody(NativeFunctionBody node) {
664 DartUnitHighlightsComputer_this._addRegion_token(node.nativeToken, Highlight Type.BUILT_IN);
665 return super.visitNativeFunctionBody(node);
666 }
667
668 @override
669 Object visitPartDirective(PartDirective node) {
670 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
671 return super.visitPartDirective(node);
672 }
673
674 @override
675 Object visitPartOfDirective(PartOfDirective node) {
676 DartUnitHighlightsComputer_this._addRegion_tokenStart_tokenEnd(node.partToke n, node.ofToken, HighlightType.BUILT_IN);
677 return super.visitPartOfDirective(node);
678 }
679
680 @override
681 Object visitShowCombinator(ShowCombinator node) {
682 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
683 return super.visitShowCombinator(node);
684 }
685
686 @override
687 Object visitSimpleIdentifier(SimpleIdentifier node) {
688 DartUnitHighlightsComputer_this._addIdentifierRegion(node);
689 return super.visitSimpleIdentifier(node);
690 }
691
692 @override
693 Object visitSimpleStringLiteral(SimpleStringLiteral node) {
694 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ STRING);
695 return super.visitSimpleStringLiteral(node);
696 }
697
698 @override
699 Object visitTypeName(TypeName node) {
700 DartType type = node.type;
701 if (type != null) {
702 if (type.isDynamic && node.name.name == "dynamic") {
703 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.TYPE _NAME_DYNAMIC);
704 return null;
705 }
706 }
707 return super.visitTypeName(node);
708 }
709 }
710
711 /** 303 /**
712 * A concrete implementation of [NavigationRegion]. 304 * A computer for [NavigationRegion]s in a Dart [CompilationUnit].
713 */ 305 */
714 class NavigationRegionImpl extends SourceRegionImpl implements NavigationRegion { 306 class DartUnitNavigationComputer {
715 final List<NavigationTarget> targets; 307 final CompilationUnit _unit;
716 308
717 NavigationRegionImpl(int offset, int length, this.targets) : super(offset, len gth); 309 List<NavigationRegion> _regions = [];
718 310
719 @override 311 DartUnitNavigationComputer(this._unit);
720 String toString() { 312
721 JavaStringBuilder builder = new JavaStringBuilder(); 313 /**
722 builder.append(super.toString()); 314 * Returns the computed [NavigationRegion]s, not `null`.
723 builder.append(" -> ["); 315 */
724 builder.append(StringUtils.join(targets, ", ")); 316 List<NavigationRegion> compute() {
725 builder.append("]"); 317 _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this ));
726 return builder.toString(); 318 return new List.from(_regions);
727 } 319 }
320
321 /**
322 * If the given [Element] is not `null`, then creates a corresponding
323 * [NavigationRegion].
324 */
325 void _addRegion(int offset, int length, Element element) {
326 NavigationTarget target = _createTarget(element);
327 if (target == null) {
328 return;
329 }
330 _regions.add(new NavigationRegionImpl(offset, length, <NavigationTarget> [ta rget]));
331 }
332
333 void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, Element element) {
334 int offset = a.offset;
335 int length = b.end - offset;
336 _addRegion(offset, length, element);
337 }
338
339 /**
340 * If the given [Element] is not `null`, then creates a corresponding
341 * [NavigationRegion].
342 */
343 void _addRegionForNode(AstNode node, Element element) {
344 int offset = node.offset;
345 int length = node.length;
346 _addRegion(offset, length, element);
347 }
348
349 /**
350 * If the given [Element] is not `null`, then creates a corresponding
351 * [NavigationRegion].
352 */
353 void _addRegionForToken(Token token, Element element) {
354 int offset = token.offset;
355 int length = token.length;
356 _addRegion(offset, length, element);
357 }
358
359 /**
360 * Returns the [NavigationTarget] for the given [Element], maybe `null` if
361 * `null` was given.
362 */
363 NavigationTarget _createTarget(Element element) {
364 if (element == null) {
365 return null;
366 }
367 if (element is FieldFormalParameterElement) {
368 element = (element as FieldFormalParameterElement).field;
369 }
370 int nameOffset = element.nameOffset;
371 int nameLength = element.displayName.length;
372 if (nameOffset == -1) {
373 nameLength = 0;
374 }
375 return new NavigationTargetImpl(element.source, _getElementId(element), name Offset, nameLength);
376 }
377
378 String _getElementId(Element element) => element.location.encoding;
728 } 379 }
729 380
730 /** 381 /**
731 * A concrete implementation of [NavigationTarget].
732 */
733 class NavigationTargetImpl implements NavigationTarget {
734 final Source source;
735
736 final String elementId;
737
738 final int offset;
739
740 final int length;
741
742 NavigationTargetImpl(this.source, this.elementId, this.offset, this.length);
743
744 @override
745 String toString() {
746 JavaStringBuilder builder = new JavaStringBuilder();
747 builder.append("[offset=");
748 builder.append(offset);
749 builder.append(", length=");
750 builder.append(length);
751 builder.append(", source=");
752 builder.append(source);
753 builder.append(", element=");
754 builder.append(elementId);
755 builder.append("]");
756 return builder.toString();
757 }
758 }
759
760 /**
761 * A computer for [Outline]s in a Dart [CompilationUnit]. 382 * A computer for [Outline]s in a Dart [CompilationUnit].
762 */ 383 */
763 class DartUnitOutlineComputer { 384 class DartUnitOutlineComputer {
764 final CompilationUnit _unit; 385 final CompilationUnit _unit;
765 386
766 DartUnitOutlineComputer(this._unit); 387 DartUnitOutlineComputer(this._unit);
767 388
768 /** 389 /**
769 * Returns the computed [Outline]s, not `null`. 390 * Returns the computed [Outline]s, not `null`.
770 */ 391 */
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 return new SourceRegionImpl(firstOffset, endOffset - firstOffset); 486 return new SourceRegionImpl(firstOffset, endOffset - firstOffset);
866 } 487 }
867 // not first child: [endOfPreviousSibling, endOfNode] 488 // not first child: [endOfPreviousSibling, endOfNode]
868 int prevSiblingEnd = siblings[index - 1].end; 489 int prevSiblingEnd = siblings[index - 1].end;
869 return new SourceRegionImpl(prevSiblingEnd, endOffset - prevSiblingEnd); 490 return new SourceRegionImpl(prevSiblingEnd, endOffset - prevSiblingEnd);
870 } 491 }
871 492
872 OutlineImpl _newClassOutline(Outline unitOutline, List<Outline> unitChildren, ClassDeclaration classDeclaration) { 493 OutlineImpl _newClassOutline(Outline unitOutline, List<Outline> unitChildren, ClassDeclaration classDeclaration) {
873 SimpleIdentifier nameNode = classDeclaration.name; 494 SimpleIdentifier nameNode = classDeclaration.name;
874 String name = nameNode.name; 495 String name = nameNode.name;
875 OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(classDec laration), OutlineKind.CLASS, name, nameNode.offset, name.length, null, null, cl assDeclaration.isAbstract, false); 496 OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(classDec laration), OutlineKind.CLASS, name, nameNode.offset, name.length, null, null, cl assDeclaration.isAbstract, StringUtilities.startsWithChar(name, 0x5F), false);
876 unitChildren.add(outline); 497 unitChildren.add(outline);
877 return outline; 498 return outline;
878 } 499 }
879 500
880 void _newClassTypeAlias(Outline unitOutline, List<Outline> unitChildren, Class TypeAlias alias) { 501 void _newClassTypeAlias(Outline unitOutline, List<Outline> unitChildren, Class TypeAlias alias) {
881 SimpleIdentifier nameNode = alias.name; 502 SimpleIdentifier nameNode = alias.name;
882 unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), Outli neKind.CLASS_TYPE_ALIAS, nameNode.name, nameNode.offset, nameNode.length, null, null, alias.isAbstract, false)); 503 String name = nameNode.name;
504 unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), Outli neKind.CLASS_TYPE_ALIAS, name, nameNode.offset, nameNode.length, null, null, ali as.isAbstract, StringUtilities.startsWithChar(name, 0x5F), false));
883 } 505 }
884 506
885 void _newConstructorOutline(OutlineImpl classOutline, List<Outline> children, ConstructorDeclaration constructorDeclaration) { 507 void _newConstructorOutline(OutlineImpl classOutline, List<Outline> children, ConstructorDeclaration constructorDeclaration) {
886 Identifier returnType = constructorDeclaration.returnType; 508 Identifier returnType = constructorDeclaration.returnType;
887 String name = returnType.name; 509 String name = returnType.name;
888 int offset = returnType.offset; 510 int offset = returnType.offset;
889 int length = returnType.length; 511 int length = returnType.length;
512 bool isPrivate = false;
890 SimpleIdentifier constructorNameNode = constructorDeclaration.name; 513 SimpleIdentifier constructorNameNode = constructorDeclaration.name;
891 if (constructorNameNode != null) { 514 if (constructorNameNode != null) {
892 name += ".${constructorNameNode.name}"; 515 String constructorName = constructorNameNode.name;
516 isPrivate = StringUtilities.startsWithChar(constructorName, 0x5F);
517 name += ".${constructorName}";
893 offset = constructorNameNode.offset; 518 offset = constructorNameNode.offset;
894 length = constructorNameNode.length; 519 length = constructorNameNode.length;
895 } 520 }
896 FormalParameterList parameters = constructorDeclaration.parameters; 521 FormalParameterList parameters = constructorDeclaration.parameters;
897 OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(constru ctorDeclaration), OutlineKind.CONSTRUCTOR, name, offset, length, parameters != n ull ? parameters.toSource() : "", null, false, false); 522 OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(constru ctorDeclaration), OutlineKind.CONSTRUCTOR, name, offset, length, parameters != n ull ? parameters.toSource() : "", null, false, isPrivate, false);
898 children.add(outline); 523 children.add(outline);
899 _addLocalFunctionOutlines(outline, constructorDeclaration.body); 524 _addLocalFunctionOutlines(outline, constructorDeclaration.body);
900 } 525 }
901 526
902 void _newField(OutlineImpl classOutline, List<Outline> children, String fieldT ypeName, VariableDeclaration field, bool isStatic) { 527 void _newField(OutlineImpl classOutline, List<Outline> children, String fieldT ypeName, VariableDeclaration field, bool isStatic) {
903 SimpleIdentifier nameNode = field.name; 528 SimpleIdentifier nameNode = field.name;
904 children.add(new OutlineImpl(classOutline, _getSourceRegion(field), OutlineK ind.FIELD, nameNode.name, nameNode.offset, nameNode.length, null, fieldTypeName, false, isStatic)); 529 String name = nameNode.name;
530 children.add(new OutlineImpl(classOutline, _getSourceRegion(field), OutlineK ind.FIELD, name, nameNode.offset, nameNode.length, null, fieldTypeName, false, S tringUtilities.startsWithChar(name, 0x5F), isStatic));
905 } 531 }
906 532
907 void _newFunctionOutline(Outline unitOutline, List<Outline> unitChildren, Func tionDeclaration functionDeclaration) { 533 void _newFunctionOutline(Outline unitOutline, List<Outline> unitChildren, Func tionDeclaration functionDeclaration) {
908 TypeName returnType = functionDeclaration.returnType; 534 TypeName returnType = functionDeclaration.returnType;
909 SimpleIdentifier nameNode = functionDeclaration.name; 535 SimpleIdentifier nameNode = functionDeclaration.name;
536 String name = nameNode.name;
910 FunctionExpression functionExpression = functionDeclaration.functionExpressi on; 537 FunctionExpression functionExpression = functionDeclaration.functionExpressi on;
911 FormalParameterList parameters = functionExpression.parameters; 538 FormalParameterList parameters = functionExpression.parameters;
912 OutlineKind kind; 539 OutlineKind kind;
913 if (functionDeclaration.isGetter) { 540 if (functionDeclaration.isGetter) {
914 kind = OutlineKind.GETTER; 541 kind = OutlineKind.GETTER;
915 } else if (functionDeclaration.isSetter) { 542 } else if (functionDeclaration.isSetter) {
916 kind = OutlineKind.SETTER; 543 kind = OutlineKind.SETTER;
917 } else { 544 } else {
918 kind = OutlineKind.FUNCTION; 545 kind = OutlineKind.FUNCTION;
919 } 546 }
920 OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(function Declaration), kind, nameNode.name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, false); 547 OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(function Declaration), kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", fa lse, StringUtilities.startsWithChar(name, 0x5F), false);
921 unitChildren.add(outline); 548 unitChildren.add(outline);
922 _addLocalFunctionOutlines(outline, functionExpression.body); 549 _addLocalFunctionOutlines(outline, functionExpression.body);
923 } 550 }
924 551
925 void _newFunctionTypeAliasOutline(Outline unitOutline, List<Outline> unitChild ren, FunctionTypeAlias alias) { 552 void _newFunctionTypeAliasOutline(Outline unitOutline, List<Outline> unitChild ren, FunctionTypeAlias alias) {
926 TypeName returnType = alias.returnType; 553 TypeName returnType = alias.returnType;
927 SimpleIdentifier nameNode = alias.name; 554 SimpleIdentifier nameNode = alias.name;
555 String name = nameNode.name;
928 FormalParameterList parameters = alias.parameters; 556 FormalParameterList parameters = alias.parameters;
929 unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), Outli neKind.FUNCTION_TYPE_ALIAS, nameNode.name, nameNode.offset, nameNode.length, par ameters != null ? parameters.toSource() : "", returnType != null ? returnType.to Source() : "", false, false)); 557 unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), Outli neKind.FUNCTION_TYPE_ALIAS, name, nameNode.offset, nameNode.length, parameters ! = null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, StringUtilities.startsWithChar(name, 0x5F), false));
930 } 558 }
931 559
932 void _newMethodOutline(OutlineImpl classOutline, List<Outline> children, Metho dDeclaration methodDeclaration) { 560 void _newMethodOutline(OutlineImpl classOutline, List<Outline> children, Metho dDeclaration methodDeclaration) {
933 TypeName returnType = methodDeclaration.returnType; 561 TypeName returnType = methodDeclaration.returnType;
934 SimpleIdentifier nameNode = methodDeclaration.name; 562 SimpleIdentifier nameNode = methodDeclaration.name;
563 String name = nameNode.name;
935 FormalParameterList parameters = methodDeclaration.parameters; 564 FormalParameterList parameters = methodDeclaration.parameters;
936 OutlineKind kind; 565 OutlineKind kind;
937 if (methodDeclaration.isGetter) { 566 if (methodDeclaration.isGetter) {
938 kind = OutlineKind.GETTER; 567 kind = OutlineKind.GETTER;
939 } else if (methodDeclaration.isSetter) { 568 } else if (methodDeclaration.isSetter) {
940 kind = OutlineKind.SETTER; 569 kind = OutlineKind.SETTER;
941 } else { 570 } else {
942 kind = OutlineKind.METHOD; 571 kind = OutlineKind.METHOD;
943 } 572 }
944 OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(methodD eclaration), kind, nameNode.name, nameNode.offset, nameNode.length, parameters ! = null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", methodDeclaration.isAbstract, methodDeclaration.isStatic); 573 OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(methodD eclaration), kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", met hodDeclaration.isAbstract, StringUtilities.startsWithChar(name, 0x5F), methodDec laration.isStatic);
945 children.add(outline); 574 children.add(outline);
946 _addLocalFunctionOutlines(outline, methodDeclaration.body); 575 _addLocalFunctionOutlines(outline, methodDeclaration.body);
947 } 576 }
948 577
949 OutlineImpl _newUnitOutline() => new OutlineImpl(null, new SourceRegionImpl(_u nit.offset, _unit.length), OutlineKind.COMPILATION_UNIT, null, 0, 0, null, null, false, false); 578 OutlineImpl _newUnitOutline() => new OutlineImpl(null, new SourceRegionImpl(_u nit.offset, _unit.length), OutlineKind.COMPILATION_UNIT, null, 0, 0, null, null, false, false, false);
579 }
580
581 /**
582 * A concrete implementation of [HighlightRegion].
583 */
584 class HighlightRegionImpl extends SourceRegionImpl implements HighlightRegion {
585 final HighlightType type;
586
587 HighlightRegionImpl(int offset, int length, this.type) : super(offset, length) ;
588
589 @override
590 String toString() {
591 JavaStringBuilder builder = new JavaStringBuilder();
592 builder.append("[offset=");
593 builder.append(offset);
594 builder.append(", length=");
595 builder.append(length);
596 builder.append(", type=");
597 builder.append(type);
598 builder.append("]");
599 return builder.toString();
600 }
601 }
602
603 /**
604 * A concrete implementation of [NavigationRegion].
605 */
606 class NavigationRegionImpl extends SourceRegionImpl implements NavigationRegion {
607 final List<NavigationTarget> targets;
608
609 NavigationRegionImpl(int offset, int length, this.targets) : super(offset, len gth);
610
611 @override
612 String toString() {
613 JavaStringBuilder builder = new JavaStringBuilder();
614 builder.append(super.toString());
615 builder.append(" -> [");
616 builder.append(StringUtils.join(targets, ", "));
617 builder.append("]");
618 return builder.toString();
619 }
620 }
621
622 /**
623 * A concrete implementation of [NavigationTarget].
624 */
625 class NavigationTargetImpl implements NavigationTarget {
626 final Source source;
627
628 final String elementId;
629
630 final int offset;
631
632 final int length;
633
634 NavigationTargetImpl(this.source, this.elementId, this.offset, this.length);
635
636 @override
637 String toString() {
638 JavaStringBuilder builder = new JavaStringBuilder();
639 builder.append("[offset=");
640 builder.append(offset);
641 builder.append(", length=");
642 builder.append(length);
643 builder.append(", source=");
644 builder.append(source);
645 builder.append(", element=");
646 builder.append(elementId);
647 builder.append("]");
648 return builder.toString();
649 }
650 }
651
652 /**
653 * A concrete implementation of [Outline].
654 */
655 class OutlineImpl implements Outline {
656 final Outline parent;
657
658 final SourceRegion sourceRegion;
659
660 final OutlineKind kind;
661
662 final String name;
663
664 final int offset;
665
666 final int length;
667
668 final String parameters;
669
670 final String returnType;
671
672 final bool isAbstract;
673
674 final bool isPrivate;
675
676 final bool isStatic;
677
678 List<Outline> children = Outline.EMPTY_ARRAY;
679
680 OutlineImpl(this.parent, this.sourceRegion, this.kind, this.name, this.offset, this.length, this.parameters, this.returnType, this.isAbstract, this.isPrivate, this.isStatic);
681
682 @override
683 bool operator ==(Object obj) {
684 if (identical(obj, this)) {
685 return true;
686 }
687 if (obj is! OutlineImpl) {
688 return false;
689 }
690 OutlineImpl other = obj as OutlineImpl;
691 return (other.parent == parent) && other.offset == offset;
692 }
693
694 @override
695 int get hashCode => offset;
696
697 @override
698 String toString() {
699 JavaStringBuilder builder = new JavaStringBuilder();
700 builder.append("[name=");
701 builder.append(name);
702 builder.append(", kind=");
703 builder.append(kind);
704 builder.append(", offset=");
705 builder.append(offset);
706 builder.append(", length=");
707 builder.append(length);
708 builder.append(", parameters=");
709 builder.append(parameters);
710 builder.append(", return=");
711 builder.append(returnType);
712 builder.append(", children=[");
713 builder.append(StringUtils.join(children, ", "));
714 builder.append("]]");
715 return builder.toString();
716 }
717 }
718
719 class RecursiveAstVisitor_DartUnitHighlightsComputer_compute extends RecursiveAs tVisitor<Object> {
720 final DartUnitHighlightsComputer DartUnitHighlightsComputer_this;
721
722 RecursiveAstVisitor_DartUnitHighlightsComputer_compute(this.DartUnitHighlights Computer_this) : super();
723
724 @override
725 Object visitAnnotation(Annotation node) {
726 DartUnitHighlightsComputer_this._addIdentifierRegion_annotation(node);
727 return super.visitAnnotation(node);
728 }
729
730 @override
731 Object visitAsExpression(AsExpression node) {
732 DartUnitHighlightsComputer_this._addRegion_token(node.asOperator, HighlightT ype.BUILT_IN);
733 return super.visitAsExpression(node);
734 }
735
736 @override
737 Object visitBooleanLiteral(BooleanLiteral node) {
738 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ BOOLEAN);
739 return super.visitBooleanLiteral(node);
740 }
741
742 @override
743 Object visitCatchClause(CatchClause node) {
744 DartUnitHighlightsComputer_this._addRegion_token(node.onKeyword, HighlightTy pe.BUILT_IN);
745 return super.visitCatchClause(node);
746 }
747
748 @override
749 Object visitClassDeclaration(ClassDeclaration node) {
750 DartUnitHighlightsComputer_this._addRegion_token(node.abstractKeyword, Highl ightType.BUILT_IN);
751 return super.visitClassDeclaration(node);
752 }
753
754 @override
755 Object visitConstructorDeclaration(ConstructorDeclaration node) {
756 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
757 DartUnitHighlightsComputer_this._addRegion_token(node.factoryKeyword, Highli ghtType.BUILT_IN);
758 return super.visitConstructorDeclaration(node);
759 }
760
761 @override
762 Object visitDoubleLiteral(DoubleLiteral node) {
763 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ DOUBLE);
764 return super.visitDoubleLiteral(node);
765 }
766
767 @override
768 Object visitExportDirective(ExportDirective node) {
769 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
770 return super.visitExportDirective(node);
771 }
772
773 @override
774 Object visitFieldDeclaration(FieldDeclaration node) {
775 DartUnitHighlightsComputer_this._addRegion_token(node.staticKeyword, Highlig htType.BUILT_IN);
776 return super.visitFieldDeclaration(node);
777 }
778
779 @override
780 Object visitFunctionDeclaration(FunctionDeclaration node) {
781 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
782 DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, Highl ightType.BUILT_IN);
783 return super.visitFunctionDeclaration(node);
784 }
785
786 @override
787 Object visitFunctionTypeAlias(FunctionTypeAlias node) {
788 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
789 return super.visitFunctionTypeAlias(node);
790 }
791
792 @override
793 Object visitHideCombinator(HideCombinator node) {
794 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
795 return super.visitHideCombinator(node);
796 }
797
798 @override
799 Object visitImplementsClause(ImplementsClause node) {
800 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
801 return super.visitImplementsClause(node);
802 }
803
804 @override
805 Object visitImportDirective(ImportDirective node) {
806 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
807 DartUnitHighlightsComputer_this._addRegion_token(node.deferredToken, Highlig htType.BUILT_IN);
808 DartUnitHighlightsComputer_this._addRegion_token(node.asToken, HighlightType .BUILT_IN);
809 return super.visitImportDirective(node);
810 }
811
812 @override
813 Object visitIntegerLiteral(IntegerLiteral node) {
814 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ INTEGER);
815 return super.visitIntegerLiteral(node);
816 }
817
818 @override
819 Object visitLibraryDirective(LibraryDirective node) {
820 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
821 return super.visitLibraryDirective(node);
822 }
823
824 @override
825 Object visitMethodDeclaration(MethodDeclaration node) {
826 DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, Highl ightType.BUILT_IN);
827 DartUnitHighlightsComputer_this._addRegion_token(node.modifierKeyword, Highl ightType.BUILT_IN);
828 DartUnitHighlightsComputer_this._addRegion_token(node.operatorKeyword, Highl ightType.BUILT_IN);
829 DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, Highl ightType.BUILT_IN);
830 return super.visitMethodDeclaration(node);
831 }
832
833 @override
834 Object visitNativeClause(NativeClause node) {
835 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
836 return super.visitNativeClause(node);
837 }
838
839 @override
840 Object visitNativeFunctionBody(NativeFunctionBody node) {
841 DartUnitHighlightsComputer_this._addRegion_token(node.nativeToken, Highlight Type.BUILT_IN);
842 return super.visitNativeFunctionBody(node);
843 }
844
845 @override
846 Object visitPartDirective(PartDirective node) {
847 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
848 return super.visitPartDirective(node);
849 }
850
851 @override
852 Object visitPartOfDirective(PartOfDirective node) {
853 DartUnitHighlightsComputer_this._addRegion_tokenStart_tokenEnd(node.partToke n, node.ofToken, HighlightType.BUILT_IN);
854 return super.visitPartOfDirective(node);
855 }
856
857 @override
858 Object visitShowCombinator(ShowCombinator node) {
859 DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType .BUILT_IN);
860 return super.visitShowCombinator(node);
861 }
862
863 @override
864 Object visitSimpleIdentifier(SimpleIdentifier node) {
865 DartUnitHighlightsComputer_this._addIdentifierRegion(node);
866 return super.visitSimpleIdentifier(node);
867 }
868
869 @override
870 Object visitSimpleStringLiteral(SimpleStringLiteral node) {
871 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_ STRING);
872 return super.visitSimpleStringLiteral(node);
873 }
874
875 @override
876 Object visitTypeName(TypeName node) {
877 DartType type = node.type;
878 if (type != null) {
879 if (type.isDynamic && node.name.name == "dynamic") {
880 DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.TYPE _NAME_DYNAMIC);
881 return null;
882 }
883 }
884 return super.visitTypeName(node);
885 }
886 }
887
888 class RecursiveAstVisitor_DartUnitNavigationComputer_compute extends RecursiveAs tVisitor<Object> {
889 final DartUnitNavigationComputer DartUnitNavigationComputer_this;
890
891 RecursiveAstVisitor_DartUnitNavigationComputer_compute(this.DartUnitNavigation Computer_this) : super();
892
893 @override
894 Object visitAssignmentExpression(AssignmentExpression node) {
895 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
896 return super.visitAssignmentExpression(node);
897 }
898
899 @override
900 Object visitBinaryExpression(BinaryExpression node) {
901 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
902 return super.visitBinaryExpression(node);
903 }
904
905 @override
906 Object visitExportDirective(ExportDirective node) {
907 ExportElement exportElement = node.element;
908 if (exportElement != null) {
909 Element element = exportElement.exportedLibrary;
910 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element);
911 }
912 return super.visitExportDirective(node);
913 }
914
915 @override
916 Object visitImportDirective(ImportDirective node) {
917 ImportElement importElement = node.element;
918 if (importElement != null) {
919 Element element = importElement.importedLibrary;
920 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element);
921 }
922 return super.visitImportDirective(node);
923 }
924
925 @override
926 Object visitIndexExpression(IndexExpression node) {
927 DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.b estElement);
928 return super.visitIndexExpression(node);
929 }
930
931 @override
932 Object visitPartDirective(PartDirective node) {
933 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, node.element);
934 return super.visitPartDirective(node);
935 }
936
937 @override
938 Object visitPartOfDirective(PartOfDirective node) {
939 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.libraryName, node.element);
940 return super.visitPartOfDirective(node);
941 }
942
943 @override
944 Object visitPostfixExpression(PostfixExpression node) {
945 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
946 return super.visitPostfixExpression(node);
947 }
948
949 @override
950 Object visitPrefixExpression(PrefixExpression node) {
951 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
952 return super.visitPrefixExpression(node);
953 }
954
955 @override
956 Object visitSimpleIdentifier(SimpleIdentifier node) {
957 DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement);
958 return super.visitSimpleIdentifier(node);
959 }
950 } 960 }
951 961
952 class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines exten ds RecursiveAstVisitor<Object> { 962 class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines exten ds RecursiveAstVisitor<Object> {
953 final DartUnitOutlineComputer DartUnitOutlineComputer_this; 963 final DartUnitOutlineComputer DartUnitOutlineComputer_this;
954 964
955 OutlineImpl parenet; 965 OutlineImpl parenet;
956 966
957 List<Outline> localOutlines; 967 List<Outline> localOutlines;
958 968
959 RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines(this.Dart UnitOutlineComputer_this, this.parenet, this.localOutlines) : super(); 969 RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines(this.Dart UnitOutlineComputer_this, this.parenet, this.localOutlines) : super();
960 970
961 @override 971 @override
962 Object visitFunctionDeclaration(FunctionDeclaration node) { 972 Object visitFunctionDeclaration(FunctionDeclaration node) {
963 DartUnitOutlineComputer_this._newFunctionOutline(parenet, localOutlines, nod e); 973 DartUnitOutlineComputer_this._newFunctionOutline(parenet, localOutlines, nod e);
964 return null; 974 return null;
965 } 975 }
976 }
977
978 /**
979 * A concrete implementation of [SourceRegion].
980 */
981 class SourceRegionImpl implements SourceRegion {
982 final int offset;
983
984 final int length;
985
986 SourceRegionImpl(this.offset, this.length);
987
988 @override
989 bool containsInclusive(int x) => offset <= x && x <= offset + length;
990
991 @override
992 bool operator ==(Object obj) {
993 if (identical(obj, this)) {
994 return true;
995 }
996 if (obj is! SourceRegion) {
997 return false;
998 }
999 SourceRegion other = obj as SourceRegion;
1000 return other.offset == offset && other.length == length;
1001 }
1002
1003 @override
1004 int get hashCode => ObjectUtilities.combineHashCodes(offset, length);
1005
1006 @override
1007 String toString() {
1008 JavaStringBuilder builder = new JavaStringBuilder();
1009 builder.append("[offset=");
1010 builder.append(offset);
1011 builder.append(", length=");
1012 builder.append(length);
1013 builder.append("]");
1014 return builder.toString();
1015 }
966 } 1016 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698