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

Side by Side Diff: pkg/analysis_server/lib/src/computer/computer_outline.dart

Issue 1008583002: Fix hints (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 library computer.outline; 5 library computer.outline;
6 6
7 import 'package:analysis_server/src/collections.dart'; 7 import 'package:analysis_server/src/collections.dart';
8 import 'package:analysis_server/src/protocol.dart'; 8 import 'package:analysis_server/src/protocol.dart';
9 import 'package:analyzer/src/generated/ast.dart'; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'package:analyzer/src/generated/element.dart' as engine; 10 import 'package:analyzer/src/generated/element.dart' as engine;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 node = parent.parent; 131 node = parent.parent;
132 parent = node.parent; 132 parent = node.parent;
133 } else if (variableIndex >= 1) { 133 } else if (variableIndex >= 1) {
134 firstOffset = variables[variableIndex - 1].end; 134 firstOffset = variables[variableIndex - 1].end;
135 return new _SourceRegion(firstOffset, endOffset - firstOffset); 135 return new _SourceRegion(firstOffset, endOffset - firstOffset);
136 } 136 }
137 } 137 }
138 // unit or class member 138 // unit or class member
139 if (parent is CompilationUnit) { 139 if (parent is CompilationUnit) {
140 firstOffset = 0; 140 firstOffset = 0;
141 siblings = (parent as CompilationUnit).declarations; 141 siblings = parent.declarations;
142 } else if (parent is ClassDeclaration) { 142 } else if (parent is ClassDeclaration) {
143 ClassDeclaration classDeclaration = parent as ClassDeclaration; 143 firstOffset = parent.leftBracket.end;
144 firstOffset = classDeclaration.leftBracket.end; 144 siblings = parent.members;
145 siblings = classDeclaration.members;
146 } else { 145 } else {
147 int offset = node.offset; 146 int offset = node.offset;
148 return new _SourceRegion(offset, endOffset - offset); 147 return new _SourceRegion(offset, endOffset - offset);
149 } 148 }
150 // first child: [endOfParent, endOfNode] 149 // first child: [endOfParent, endOfNode]
151 int index = siblings.indexOf(node); 150 int index = siblings.indexOf(node);
152 if (index == 0) { 151 if (index == 0) {
153 return new _SourceRegion(firstOffset, endOffset - firstOffset); 152 return new _SourceRegion(firstOffset, endOffset - firstOffset);
154 } 153 }
155 // not first child: [endOfPreviousSibling, endOfNode] 154 // not first child: [endOfPreviousSibling, endOfNode]
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 375 }
377 376
378 /** 377 /**
379 * A range of characters. 378 * A range of characters.
380 */ 379 */
381 class _SourceRegion { 380 class _SourceRegion {
382 final int length; 381 final int length;
383 final int offset; 382 final int offset;
384 _SourceRegion(this.offset, this.length); 383 _SourceRegion(this.offset, this.length);
385 } 384 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_highlights.dart ('k') | pkg/analysis_server/lib/src/context_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698