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

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

Issue 969113002: Reformat (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;
11 import 'package:analyzer/src/generated/source.dart'; 11 import 'package:analyzer/src/generated/source.dart';
12 12
13
14 /** 13 /**
15 * A computer for [CompilationUnit] outline. 14 * A computer for [CompilationUnit] outline.
16 */ 15 */
17 class DartUnitOutlineComputer { 16 class DartUnitOutlineComputer {
18 final String file; 17 final String file;
19 final CompilationUnit unit; 18 final CompilationUnit unit;
20 final LineInfo lineInfo; 19 final LineInfo lineInfo;
21 20
22 DartUnitOutlineComputer(this.file, this.lineInfo, this.unit); 21 DartUnitOutlineComputer(this.file, this.lineInfo, this.unit);
23 22
(...skipping 12 matching lines...) Expand all
36 classContents.add(_newConstructorOutline(constructorDeclaration)); 35 classContents.add(_newConstructorOutline(constructorDeclaration));
37 } 36 }
38 if (classMember is FieldDeclaration) { 37 if (classMember is FieldDeclaration) {
39 FieldDeclaration fieldDeclaration = classMember; 38 FieldDeclaration fieldDeclaration = classMember;
40 VariableDeclarationList fields = fieldDeclaration.fields; 39 VariableDeclarationList fields = fieldDeclaration.fields;
41 if (fields != null) { 40 if (fields != null) {
42 TypeName fieldType = fields.type; 41 TypeName fieldType = fields.type;
43 String fieldTypeName = 42 String fieldTypeName =
44 fieldType != null ? fieldType.toSource() : ''; 43 fieldType != null ? fieldType.toSource() : '';
45 for (VariableDeclaration field in fields.variables) { 44 for (VariableDeclaration field in fields.variables) {
46 classContents.add( 45 classContents.add(_newVariableOutline(fieldTypeName,
47 _newVariableOutline( 46 ElementKind.FIELD, field, fieldDeclaration.isStatic));
48 fieldTypeName,
49 ElementKind.FIELD,
50 field,
51 fieldDeclaration.isStatic));
52 } 47 }
53 } 48 }
54 } 49 }
55 if (classMember is MethodDeclaration) { 50 if (classMember is MethodDeclaration) {
56 MethodDeclaration methodDeclaration = classMember; 51 MethodDeclaration methodDeclaration = classMember;
57 classContents.add(_newMethodOutline(methodDeclaration)); 52 classContents.add(_newMethodOutline(methodDeclaration));
58 } 53 }
59 } 54 }
60 unitContents.add(_newClassOutline(classDeclaration, classContents)); 55 unitContents.add(_newClassOutline(classDeclaration, classContents));
61 } 56 }
62 if (unitMember is EnumDeclaration) { 57 if (unitMember is EnumDeclaration) {
63 EnumDeclaration enumDeclaration = unitMember; 58 EnumDeclaration enumDeclaration = unitMember;
64 List<Outline> constantOutlines = <Outline>[]; 59 List<Outline> constantOutlines = <Outline>[];
65 for (EnumConstantDeclaration constant in enumDeclaration.constants) { 60 for (EnumConstantDeclaration constant in enumDeclaration.constants) {
66 constantOutlines.add(_newEnumConstant(constant)); 61 constantOutlines.add(_newEnumConstant(constant));
67 } 62 }
68 unitContents.add(_newEnumOutline(enumDeclaration, constantOutlines)); 63 unitContents.add(_newEnumOutline(enumDeclaration, constantOutlines));
69 } 64 }
70 if (unitMember is TopLevelVariableDeclaration) { 65 if (unitMember is TopLevelVariableDeclaration) {
71 TopLevelVariableDeclaration fieldDeclaration = unitMember; 66 TopLevelVariableDeclaration fieldDeclaration = unitMember;
72 VariableDeclarationList fields = fieldDeclaration.variables; 67 VariableDeclarationList fields = fieldDeclaration.variables;
73 if (fields != null) { 68 if (fields != null) {
74 TypeName fieldType = fields.type; 69 TypeName fieldType = fields.type;
75 String fieldTypeName = fieldType != null ? fieldType.toSource() : ''; 70 String fieldTypeName = fieldType != null ? fieldType.toSource() : '';
76 for (VariableDeclaration field in fields.variables) { 71 for (VariableDeclaration field in fields.variables) {
77 unitContents.add( 72 unitContents.add(_newVariableOutline(
78 _newVariableOutline( 73 fieldTypeName, ElementKind.TOP_LEVEL_VARIABLE, field, false));
79 fieldTypeName,
80 ElementKind.TOP_LEVEL_VARIABLE,
81 field,
82 false));
83 } 74 }
84 } 75 }
85 } 76 }
86 if (unitMember is FunctionDeclaration) { 77 if (unitMember is FunctionDeclaration) {
87 FunctionDeclaration functionDeclaration = unitMember; 78 FunctionDeclaration functionDeclaration = unitMember;
88 unitContents.add(_newFunctionOutline(functionDeclaration, true)); 79 unitContents.add(_newFunctionOutline(functionDeclaration, true));
89 } 80 }
90 if (unitMember is ClassTypeAlias) { 81 if (unitMember is ClassTypeAlias) {
91 ClassTypeAlias alias = unitMember; 82 ClassTypeAlias alias = unitMember;
92 unitContents.add(_newClassTypeAlias(alias)); 83 unitContents.add(_newClassTypeAlias(alias));
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // first child: [endOfParent, endOfNode] 150 // first child: [endOfParent, endOfNode]
160 int index = siblings.indexOf(node); 151 int index = siblings.indexOf(node);
161 if (index == 0) { 152 if (index == 0) {
162 return new _SourceRegion(firstOffset, endOffset - firstOffset); 153 return new _SourceRegion(firstOffset, endOffset - firstOffset);
163 } 154 }
164 // not first child: [endOfPreviousSibling, endOfNode] 155 // not first child: [endOfPreviousSibling, endOfNode]
165 int prevSiblingEnd = siblings[index - 1].end; 156 int prevSiblingEnd = siblings[index - 1].end;
166 return new _SourceRegion(prevSiblingEnd, endOffset - prevSiblingEnd); 157 return new _SourceRegion(prevSiblingEnd, endOffset - prevSiblingEnd);
167 } 158 }
168 159
169 Outline _newClassOutline(ClassDeclaration classDeclaration, 160 Outline _newClassOutline(
170 List<Outline> classContents) { 161 ClassDeclaration classDeclaration, List<Outline> classContents) {
171 SimpleIdentifier nameNode = classDeclaration.name; 162 SimpleIdentifier nameNode = classDeclaration.name;
172 String name = nameNode.name; 163 String name = nameNode.name;
173 _SourceRegion sourceRegion = _getSourceRegion(classDeclaration); 164 _SourceRegion sourceRegion = _getSourceRegion(classDeclaration);
174 Element element = new Element( 165 Element element = new Element(ElementKind.CLASS, name, Element.makeFlags(
175 ElementKind.CLASS,
176 name,
177 Element.makeFlags(
178 isPrivate: Identifier.isPrivateName(name), 166 isPrivate: Identifier.isPrivateName(name),
179 isDeprecated: _isDeprecated(classDeclaration), 167 isDeprecated: _isDeprecated(classDeclaration),
180 isAbstract: classDeclaration.isAbstract), 168 isAbstract: classDeclaration.isAbstract),
181 location: _getLocationNode(nameNode)); 169 location: _getLocationNode(nameNode));
182 return new Outline( 170 return new Outline(element, sourceRegion.offset, sourceRegion.length,
183 element,
184 sourceRegion.offset,
185 sourceRegion.length,
186 children: nullIfEmpty(classContents)); 171 children: nullIfEmpty(classContents));
187 } 172 }
188 173
189 Outline _newClassTypeAlias(ClassTypeAlias alias) { 174 Outline _newClassTypeAlias(ClassTypeAlias alias) {
190 SimpleIdentifier nameNode = alias.name; 175 SimpleIdentifier nameNode = alias.name;
191 String name = nameNode.name; 176 String name = nameNode.name;
192 _SourceRegion sourceRegion = _getSourceRegion(alias); 177 _SourceRegion sourceRegion = _getSourceRegion(alias);
193 Element element = new Element( 178 Element element = new Element(ElementKind.CLASS_TYPE_ALIAS, name, Element
194 ElementKind.CLASS_TYPE_ALIAS, 179 .makeFlags(
195 name, 180 isPrivate: Identifier.isPrivateName(name),
196 Element.makeFlags( 181 isDeprecated: _isDeprecated(alias),
197 isPrivate: Identifier.isPrivateName(name), 182 isAbstract: alias.isAbstract),
198 isDeprecated: _isDeprecated(alias),
199 isAbstract: alias.isAbstract),
200 location: _getLocationNode(nameNode)); 183 location: _getLocationNode(nameNode));
201 return new Outline(element, sourceRegion.offset, sourceRegion.length); 184 return new Outline(element, sourceRegion.offset, sourceRegion.length);
202 } 185 }
203 186
204 Outline _newConstructorOutline(ConstructorDeclaration constructor) { 187 Outline _newConstructorOutline(ConstructorDeclaration constructor) {
205 Identifier returnType = constructor.returnType; 188 Identifier returnType = constructor.returnType;
206 String name = returnType.name; 189 String name = returnType.name;
207 int offset = returnType.offset; 190 int offset = returnType.offset;
208 int length = returnType.length; 191 int length = returnType.length;
209 SimpleIdentifier constructorNameNode = constructor.name; 192 SimpleIdentifier constructorNameNode = constructor.name;
210 bool isPrivate = false; 193 bool isPrivate = false;
211 if (constructorNameNode != null) { 194 if (constructorNameNode != null) {
212 String constructorName = constructorNameNode.name; 195 String constructorName = constructorNameNode.name;
213 isPrivate = Identifier.isPrivateName(constructorName); 196 isPrivate = Identifier.isPrivateName(constructorName);
214 name += '.${constructorName}'; 197 name += '.${constructorName}';
215 offset = constructorNameNode.offset; 198 offset = constructorNameNode.offset;
216 length = constructorNameNode.length; 199 length = constructorNameNode.length;
217 } 200 }
218 _SourceRegion sourceRegion = _getSourceRegion(constructor); 201 _SourceRegion sourceRegion = _getSourceRegion(constructor);
219 FormalParameterList parameters = constructor.parameters; 202 FormalParameterList parameters = constructor.parameters;
220 String parametersStr = parameters != null ? parameters.toSource() : ''; 203 String parametersStr = parameters != null ? parameters.toSource() : '';
221 Element element = new Element( 204 Element element = new Element(ElementKind.CONSTRUCTOR, name, Element
222 ElementKind.CONSTRUCTOR, 205 .makeFlags(
223 name, 206 isPrivate: isPrivate, isDeprecated: _isDeprecated(constructor)),
224 Element.makeFlags(
225 isPrivate: isPrivate,
226 isDeprecated: _isDeprecated(constructor)),
227 location: _getLocationOffsetLength(offset, length), 207 location: _getLocationOffsetLength(offset, length),
228 parameters: parametersStr); 208 parameters: parametersStr);
229 List<Outline> contents = _addLocalFunctionOutlines(constructor.body); 209 List<Outline> contents = _addLocalFunctionOutlines(constructor.body);
230 Outline outline = new Outline( 210 Outline outline = new Outline(
231 element, 211 element, sourceRegion.offset, sourceRegion.length,
232 sourceRegion.offset,
233 sourceRegion.length,
234 children: nullIfEmpty(contents)); 212 children: nullIfEmpty(contents));
235 return outline; 213 return outline;
236 } 214 }
237 215
238 Outline _newEnumConstant(EnumConstantDeclaration node) { 216 Outline _newEnumConstant(EnumConstantDeclaration node) {
239 SimpleIdentifier nameNode = node.name; 217 SimpleIdentifier nameNode = node.name;
240 String name = nameNode.name; 218 String name = nameNode.name;
241 _SourceRegion sourceRegion = _getSourceRegion(node); 219 _SourceRegion sourceRegion = _getSourceRegion(node);
242 Element element = new Element( 220 Element element = new Element(ElementKind.ENUM_CONSTANT, name, Element
243 ElementKind.ENUM_CONSTANT, 221 .makeFlags(
244 name, 222 isPrivate: Identifier.isPrivateName(name),
245 Element.makeFlags( 223 isDeprecated: _isDeprecated(node)),
246 isPrivate: Identifier.isPrivateName(name),
247 isDeprecated: _isDeprecated(node)),
248 location: _getLocationNode(nameNode)); 224 location: _getLocationNode(nameNode));
249 return new Outline(element, sourceRegion.offset, sourceRegion.length); 225 return new Outline(element, sourceRegion.offset, sourceRegion.length);
250 } 226 }
251 227
252 Outline _newEnumOutline(EnumDeclaration node, List<Outline> children) { 228 Outline _newEnumOutline(EnumDeclaration node, List<Outline> children) {
253 SimpleIdentifier nameNode = node.name; 229 SimpleIdentifier nameNode = node.name;
254 String name = nameNode.name; 230 String name = nameNode.name;
255 _SourceRegion sourceRegion = _getSourceRegion(node); 231 _SourceRegion sourceRegion = _getSourceRegion(node);
256 Element element = new Element( 232 Element element = new Element(ElementKind.ENUM, name, Element.makeFlags(
257 ElementKind.ENUM,
258 name,
259 Element.makeFlags(
260 isPrivate: Identifier.isPrivateName(name), 233 isPrivate: Identifier.isPrivateName(name),
261 isDeprecated: _isDeprecated(node)), 234 isDeprecated: _isDeprecated(node)),
262 location: _getLocationNode(nameNode)); 235 location: _getLocationNode(nameNode));
263 return new Outline( 236 return new Outline(element, sourceRegion.offset, sourceRegion.length,
264 element,
265 sourceRegion.offset,
266 sourceRegion.length,
267 children: nullIfEmpty(children)); 237 children: nullIfEmpty(children));
268 } 238 }
269 239
270 Outline _newFunctionOutline(FunctionDeclaration function, bool isStatic) { 240 Outline _newFunctionOutline(FunctionDeclaration function, bool isStatic) {
271 TypeName returnType = function.returnType; 241 TypeName returnType = function.returnType;
272 SimpleIdentifier nameNode = function.name; 242 SimpleIdentifier nameNode = function.name;
273 String name = nameNode.name; 243 String name = nameNode.name;
274 FunctionExpression functionExpression = function.functionExpression; 244 FunctionExpression functionExpression = function.functionExpression;
275 FormalParameterList parameters = functionExpression.parameters; 245 FormalParameterList parameters = functionExpression.parameters;
276 ElementKind kind; 246 ElementKind kind;
277 if (function.isGetter) { 247 if (function.isGetter) {
278 kind = ElementKind.GETTER; 248 kind = ElementKind.GETTER;
279 } else if (function.isSetter) { 249 } else if (function.isSetter) {
280 kind = ElementKind.SETTER; 250 kind = ElementKind.SETTER;
281 } else { 251 } else {
282 kind = ElementKind.FUNCTION; 252 kind = ElementKind.FUNCTION;
283 } 253 }
284 _SourceRegion sourceRegion = _getSourceRegion(function); 254 _SourceRegion sourceRegion = _getSourceRegion(function);
285 String parametersStr = parameters != null ? parameters.toSource() : ''; 255 String parametersStr = parameters != null ? parameters.toSource() : '';
286 String returnTypeStr = returnType != null ? returnType.toSource() : ''; 256 String returnTypeStr = returnType != null ? returnType.toSource() : '';
287 Element element = new Element( 257 Element element = new Element(kind, name, Element.makeFlags(
288 kind,
289 name,
290 Element.makeFlags(
291 isPrivate: Identifier.isPrivateName(name), 258 isPrivate: Identifier.isPrivateName(name),
292 isDeprecated: _isDeprecated(function), 259 isDeprecated: _isDeprecated(function),
293 isStatic: isStatic), 260 isStatic: isStatic),
294 location: _getLocationNode(nameNode), 261 location: _getLocationNode(nameNode),
295 parameters: parametersStr, 262 parameters: parametersStr,
296 returnType: returnTypeStr); 263 returnType: returnTypeStr);
297 List<Outline> contents = _addLocalFunctionOutlines(functionExpression.body); 264 List<Outline> contents = _addLocalFunctionOutlines(functionExpression.body);
298 Outline outline = new Outline( 265 Outline outline = new Outline(
299 element, 266 element, sourceRegion.offset, sourceRegion.length,
300 sourceRegion.offset,
301 sourceRegion.length,
302 children: nullIfEmpty(contents)); 267 children: nullIfEmpty(contents));
303 return outline; 268 return outline;
304 } 269 }
305 270
306 Outline _newFunctionTypeAliasOutline(FunctionTypeAlias alias) { 271 Outline _newFunctionTypeAliasOutline(FunctionTypeAlias alias) {
307 TypeName returnType = alias.returnType; 272 TypeName returnType = alias.returnType;
308 SimpleIdentifier nameNode = alias.name; 273 SimpleIdentifier nameNode = alias.name;
309 String name = nameNode.name; 274 String name = nameNode.name;
310 _SourceRegion sourceRegion = _getSourceRegion(alias); 275 _SourceRegion sourceRegion = _getSourceRegion(alias);
311 FormalParameterList parameters = alias.parameters; 276 FormalParameterList parameters = alias.parameters;
312 String parametersStr = parameters != null ? parameters.toSource() : ''; 277 String parametersStr = parameters != null ? parameters.toSource() : '';
313 String returnTypeStr = returnType != null ? returnType.toSource() : ''; 278 String returnTypeStr = returnType != null ? returnType.toSource() : '';
314 Element element = new Element( 279 Element element = new Element(ElementKind.FUNCTION_TYPE_ALIAS, name, Element
315 ElementKind.FUNCTION_TYPE_ALIAS, 280 .makeFlags(
316 name, 281 isPrivate: Identifier.isPrivateName(name),
317 Element.makeFlags( 282 isDeprecated: _isDeprecated(alias)),
318 isPrivate: Identifier.isPrivateName(name),
319 isDeprecated: _isDeprecated(alias)),
320 location: _getLocationNode(nameNode), 283 location: _getLocationNode(nameNode),
321 parameters: parametersStr, 284 parameters: parametersStr,
322 returnType: returnTypeStr); 285 returnType: returnTypeStr);
323 return new Outline(element, sourceRegion.offset, sourceRegion.length); 286 return new Outline(element, sourceRegion.offset, sourceRegion.length);
324 } 287 }
325 288
326 Outline _newMethodOutline(MethodDeclaration method) { 289 Outline _newMethodOutline(MethodDeclaration method) {
327 TypeName returnType = method.returnType; 290 TypeName returnType = method.returnType;
328 SimpleIdentifier nameNode = method.name; 291 SimpleIdentifier nameNode = method.name;
329 String name = nameNode.name; 292 String name = nameNode.name;
330 FormalParameterList parameters = method.parameters; 293 FormalParameterList parameters = method.parameters;
331 ElementKind kind; 294 ElementKind kind;
332 if (method.isGetter) { 295 if (method.isGetter) {
333 kind = ElementKind.GETTER; 296 kind = ElementKind.GETTER;
334 } else if (method.isSetter) { 297 } else if (method.isSetter) {
335 kind = ElementKind.SETTER; 298 kind = ElementKind.SETTER;
336 } else { 299 } else {
337 kind = ElementKind.METHOD; 300 kind = ElementKind.METHOD;
338 } 301 }
339 _SourceRegion sourceRegion = _getSourceRegion(method); 302 _SourceRegion sourceRegion = _getSourceRegion(method);
340 String parametersStr = parameters != null ? parameters.toSource() : null; 303 String parametersStr = parameters != null ? parameters.toSource() : null;
341 String returnTypeStr = returnType != null ? returnType.toSource() : ''; 304 String returnTypeStr = returnType != null ? returnType.toSource() : '';
342 Element element = new Element( 305 Element element = new Element(kind, name, Element.makeFlags(
343 kind,
344 name,
345 Element.makeFlags(
346 isPrivate: Identifier.isPrivateName(name), 306 isPrivate: Identifier.isPrivateName(name),
347 isDeprecated: _isDeprecated(method), 307 isDeprecated: _isDeprecated(method),
348 isAbstract: method.isAbstract, 308 isAbstract: method.isAbstract,
349 isStatic: method.isStatic), 309 isStatic: method.isStatic),
350 location: _getLocationNode(nameNode), 310 location: _getLocationNode(nameNode),
351 parameters: parametersStr, 311 parameters: parametersStr,
352 returnType: returnTypeStr); 312 returnType: returnTypeStr);
353 List<Outline> contents = _addLocalFunctionOutlines(method.body); 313 List<Outline> contents = _addLocalFunctionOutlines(method.body);
354 Outline outline = new Outline( 314 Outline outline = new Outline(
355 element, 315 element, sourceRegion.offset, sourceRegion.length,
356 sourceRegion.offset,
357 sourceRegion.length,
358 children: nullIfEmpty(contents)); 316 children: nullIfEmpty(contents));
359 return outline; 317 return outline;
360 } 318 }
361 319
362 Outline _newUnitOutline(List<Outline> unitContents) { 320 Outline _newUnitOutline(List<Outline> unitContents) {
363 Element element = new Element( 321 Element element = new Element(
364 ElementKind.COMPILATION_UNIT, 322 ElementKind.COMPILATION_UNIT, '<unit>', Element.makeFlags(),
365 '<unit>',
366 Element.makeFlags(),
367 location: _getLocationNode(unit)); 323 location: _getLocationNode(unit));
368 return new Outline( 324 return new Outline(element, unit.offset, unit.length,
369 element,
370 unit.offset,
371 unit.length,
372 children: nullIfEmpty(unitContents)); 325 children: nullIfEmpty(unitContents));
373 } 326 }
374 327
375 Outline _newVariableOutline(String typeName, ElementKind kind, 328 Outline _newVariableOutline(String typeName, ElementKind kind,
376 VariableDeclaration variable, bool isStatic) { 329 VariableDeclaration variable, bool isStatic) {
377 SimpleIdentifier nameNode = variable.name; 330 SimpleIdentifier nameNode = variable.name;
378 String name = nameNode.name; 331 String name = nameNode.name;
379 _SourceRegion sourceRegion = _getSourceRegion(variable); 332 _SourceRegion sourceRegion = _getSourceRegion(variable);
380 Element element = new Element( 333 Element element = new Element(kind, name, Element.makeFlags(
381 kind,
382 name,
383 Element.makeFlags(
384 isPrivate: Identifier.isPrivateName(name), 334 isPrivate: Identifier.isPrivateName(name),
385 isDeprecated: _isDeprecated(variable), 335 isDeprecated: _isDeprecated(variable),
386 isStatic: isStatic, 336 isStatic: isStatic,
387 isConst: variable.isConst, 337 isConst: variable.isConst,
388 isFinal: variable.isFinal), 338 isFinal: variable.isFinal),
389 location: _getLocationNode(nameNode), 339 location: _getLocationNode(nameNode), returnType: typeName);
390 returnType: typeName);
391 Outline outline = 340 Outline outline =
392 new Outline(element, sourceRegion.offset, sourceRegion.length); 341 new Outline(element, sourceRegion.offset, sourceRegion.length);
393 return outline; 342 return outline;
394 } 343 }
395 344
396 /** 345 /**
397 * Returns `true` if the given [element] is not `null` and deprecated. 346 * Returns `true` if the given [element] is not `null` and deprecated.
398 */ 347 */
399 static bool _isDeprecated(Declaration declaration) { 348 static bool _isDeprecated(Declaration declaration) {
400 engine.Element element = declaration.element; 349 engine.Element element = declaration.element;
401 return element != null && element.isDeprecated; 350 return element != null && element.isDeprecated;
402 } 351 }
403 } 352 }
404 353
405
406 /** 354 /**
407 * A visitor for building local function outlines. 355 * A visitor for building local function outlines.
408 */ 356 */
409 class _LocalFunctionOutlinesVisitor extends RecursiveAstVisitor { 357 class _LocalFunctionOutlinesVisitor extends RecursiveAstVisitor {
410 final DartUnitOutlineComputer outlineComputer; 358 final DartUnitOutlineComputer outlineComputer;
411 final List<Outline> contents; 359 final List<Outline> contents;
412 360
413 _LocalFunctionOutlinesVisitor(this.outlineComputer, this.contents); 361 _LocalFunctionOutlinesVisitor(this.outlineComputer, this.contents);
414 362
415 @override 363 @override
416 visitFunctionDeclaration(FunctionDeclaration node) { 364 visitFunctionDeclaration(FunctionDeclaration node) {
417 contents.add(outlineComputer._newFunctionOutline(node, false)); 365 contents.add(outlineComputer._newFunctionOutline(node, false));
418 } 366 }
419 } 367 }
420 368
421
422 /** 369 /**
423 * A range of characters. 370 * A range of characters.
424 */ 371 */
425 class _SourceRegion { 372 class _SourceRegion {
426 final int length; 373 final int length;
427 final int offset; 374 final int offset;
428 _SourceRegion(this.offset, this.length); 375 _SourceRegion(this.offset, this.length);
429 } 376 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698