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

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

Issue 304323004: Computers and services snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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' as pae; 15 import 'package:analyzer/src/generated/element.dart' as pae;
16 import 'package:analyzer/src/generated/element.dart' show DartType; 16 import 'package:analyzer/src/generated/element.dart' show DartType;
17 import 'package:analyzer/src/generated/source.dart'; 17 import 'package:analyzer/src/generated/source.dart';
18 import 'service_interfaces.dart' as psi; 18 import 'service_interfaces.dart' as psi;
19 19
20 /** 20 /**
21 * A concrete implementation of [CompletionSuggestion].
22 */
23 class CompletionSuggestionImpl implements psi.CompletionSuggestion {
24 final String completion;
25
26 final String declaringType;
27
28 final String elementDocSummary;
29
30 final String elementDocDetails;
31
32 final psi.CompletionSuggestionKind kind;
33
34 final int location;
35
36 final String parameterName;
37
38 final List<String> parameterNames;
39
40 final String parameterType;
41
42 final List<String> parameterTypes;
43
44 final int positionalParameterCount;
45
46 final int relevance;
47
48 final int replacementLength;
49
50 final int replacementLengthIdentifier;
51
52 final String returnType;
53
54 final bool hasNamed;
55
56 final bool hasPositional;
57
58 final bool isDeprecated;
59
60 final bool isPotentialMatch;
61
62 CompletionSuggestionImpl(this.elementDocSummary, this.elementDocDetails, this. completion, this.declaringType, this.kind, this.location, this.parameterName, th is.parameterNames, this.parameterType, this.parameterTypes, this.positionalParam eterCount, this.relevance, this.replacementLength, this.replacementLengthIdentif ier, this.returnType, this.hasNamed, this.hasPositional, this.isDeprecated, this .isPotentialMatch);
63 }
64
65 /**
21 * A computer for [HighlightRegion]s in a Dart [CompilationUnit]. 66 * A computer for [HighlightRegion]s in a Dart [CompilationUnit].
22 */ 67 */
23 class DartUnitHighlightsComputer { 68 class DartUnitHighlightsComputer {
24 final CompilationUnit _unit; 69 final CompilationUnit _unit;
25 70
26 List<psi.HighlightRegion> _regions = []; 71 List<psi.HighlightRegion> _regions = [];
27 72
28 DartUnitHighlightsComputer(this._unit); 73 DartUnitHighlightsComputer(this._unit);
29 74
30 /** 75 /**
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 int offset = a.offset; 344 int offset = a.offset;
300 int end = b.end; 345 int end = b.end;
301 _addRegion(offset, end - offset, type); 346 _addRegion(offset, end - offset, type);
302 } 347 }
303 } 348 }
304 349
305 /** 350 /**
306 * A computer for [NavigationRegion]s in a Dart [CompilationUnit]. 351 * A computer for [NavigationRegion]s in a Dart [CompilationUnit].
307 */ 352 */
308 class DartUnitNavigationComputer { 353 class DartUnitNavigationComputer {
354 final String _contextId;
355
309 final CompilationUnit _unit; 356 final CompilationUnit _unit;
310 357
311 List<psi.NavigationRegion> _regions = []; 358 List<psi.NavigationRegion> _regions = [];
312 359
313 DartUnitNavigationComputer(this._unit); 360 DartUnitNavigationComputer(this._contextId, this._unit);
314 361
315 /** 362 /**
316 * Returns the computed [NavigationRegion]s, not `null`. 363 * Returns the computed [NavigationRegion]s, not `null`.
317 */ 364 */
318 List<psi.NavigationRegion> compute() { 365 List<psi.NavigationRegion> compute() {
319 _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this )); 366 _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this ));
320 return new List.from(_regions); 367 return new List.from(_regions);
321 } 368 }
322 369
323 /** 370 /**
324 * If the given [Element] is not `null`, then creates a corresponding 371 * If the given [Element] is not `null`, then creates a corresponding
325 * [NavigationRegion]. 372 * [NavigationRegion].
326 */ 373 */
327 void _addRegion(int offset, int length, pae.Element element) { 374 void _addRegion(int offset, int length, pae.Element element) {
328 psi.Element target = _createTarget(element); 375 psi.Element target = _createTarget(element);
329 if (target == null) { 376 if (target == null) {
330 return; 377 return;
331 } 378 }
332 _regions.add(new NavigationRegionImpl(offset, length, <psi.Element> [target] )); 379 _regions.add(new NavigationRegionImpl(offset, length, <psi.Element> [target] ));
333 } 380 }
334 381
382 void _addRegion_nodeStart_nodeEnd(AstNode a, AstNode b, pae.Element element) {
383 int offset = a.offset;
384 int length = b.end - offset;
385 _addRegion(offset, length, element);
386 }
387
388 void _addRegion_nodeStart_nodeStart(AstNode a, AstNode b, pae.Element element) {
389 int offset = a.offset;
390 int length = b.offset - offset;
391 _addRegion(offset, length, element);
392 }
393
335 void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, pae.Element element) { 394 void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, pae.Element element) {
336 int offset = a.offset; 395 int offset = a.offset;
337 int length = b.end - offset; 396 int length = b.end - offset;
338 _addRegion(offset, length, element); 397 _addRegion(offset, length, element);
339 } 398 }
340 399
341 /** 400 /**
342 * If the given [Element] is not `null`, then creates a corresponding 401 * If the given [Element] is not `null`, then creates a corresponding
343 * [NavigationRegion]. 402 * [NavigationRegion].
344 */ 403 */
(...skipping 17 matching lines...) Expand all
362 * Returns the [com.google.dart.server.Element] for the given [Element], maybe 421 * Returns the [com.google.dart.server.Element] for the given [Element], maybe
363 * `null` if `null` was given. 422 * `null` if `null` was given.
364 */ 423 */
365 psi.Element _createTarget(pae.Element element) { 424 psi.Element _createTarget(pae.Element element) {
366 if (element == null) { 425 if (element == null) {
367 return null; 426 return null;
368 } 427 }
369 if (element is pae.FieldFormalParameterElement) { 428 if (element is pae.FieldFormalParameterElement) {
370 element = (element as pae.FieldFormalParameterElement).field; 429 element = (element as pae.FieldFormalParameterElement).field;
371 } 430 }
372 return ElementImpl.create(element); 431 return ElementImpl.create(_contextId, element);
373 } 432 }
374 } 433 }
375 434
376 /** 435 /**
377 * A computer for [Outline]s in a Dart [CompilationUnit]. 436 * A computer for [Outline]s in a Dart [CompilationUnit].
378 */ 437 */
379 class DartUnitOutlineComputer { 438 class DartUnitOutlineComputer {
380 static String _UNITTEST_LIBRARY = "unittest"; 439 static String _UNITTEST_LIBRARY = "unittest";
381 440
441 final String _contextId;
442
382 final Source _source; 443 final Source _source;
383 444
384 final CompilationUnit _unit; 445 final CompilationUnit _unit;
385 446
386 DartUnitOutlineComputer(this._source, this._unit); 447 DartUnitOutlineComputer(this._contextId, this._source, this._unit);
387 448
388 /** 449 /**
389 * Returns the computed [Outline]s, not `null`. 450 * Returns the computed [Outline]s, not `null`.
390 */ 451 */
391 psi.Outline compute() { 452 psi.Outline compute() {
392 OutlineImpl unitOutline = _newUnitOutline(); 453 OutlineImpl unitOutline = _newUnitOutline();
393 List<psi.Outline> unitChildren = []; 454 List<psi.Outline> unitChildren = [];
394 for (CompilationUnitMember unitMember in _unit.declarations) { 455 for (CompilationUnitMember unitMember in _unit.declarations) {
395 if (unitMember is ClassDeclaration) { 456 if (unitMember is ClassDeclaration) {
396 ClassDeclaration classDeclartion = unitMember; 457 ClassDeclaration classDeclartion = unitMember;
397 OutlineImpl classOutline = _newClassOutline(unitOutline, unitChildren, c lassDeclartion); 458 OutlineImpl classOutline = _newClassOutline(unitOutline, unitChildren, c lassDeclartion);
398 List<psi.Outline> classChildren = []; 459 List<psi.Outline> classChildren = [];
399 for (ClassMember classMember in classDeclartion.members) { 460 for (ClassMember classMember in classDeclartion.members) {
400 if (classMember is ConstructorDeclaration) { 461 if (classMember is ConstructorDeclaration) {
401 ConstructorDeclaration constructorDeclaration = classMember; 462 ConstructorDeclaration constructorDeclaration = classMember;
402 _newConstructorOutline(classOutline, classChildren, constructorDecla ration); 463 _newConstructorOutline(classOutline, classChildren, constructorDecla ration);
403 } 464 }
404 if (classMember is FieldDeclaration) { 465 if (classMember is FieldDeclaration) {
405 FieldDeclaration fieldDeclaration = classMember; 466 FieldDeclaration fieldDeclaration = classMember;
406 VariableDeclarationList fields = fieldDeclaration.fields; 467 VariableDeclarationList fields = fieldDeclaration.fields;
407 if (fields != null) { 468 if (fields != null) {
408 TypeName fieldType = fields.type; 469 TypeName fieldType = fields.type;
409 String fieldTypeName = fieldType != null ? fieldType.toSource() : ""; 470 String fieldTypeName = fieldType != null ? fieldType.toSource() : "";
410 for (VariableDeclaration field in fields.variables) { 471 for (VariableDeclaration field in fields.variables) {
411 _newField(classOutline, classChildren, fieldTypeName, field, fie ldDeclaration.isStatic); 472 _newVariableOutline(classOutline, classChildren, fieldTypeName, psi.ElementKind.FIELD, field, fieldDeclaration.isStatic);
412 } 473 }
413 } 474 }
414 } 475 }
415 if (classMember is MethodDeclaration) { 476 if (classMember is MethodDeclaration) {
416 MethodDeclaration methodDeclaration = classMember; 477 MethodDeclaration methodDeclaration = classMember;
417 _newMethodOutline(classOutline, classChildren, methodDeclaration); 478 _newMethodOutline(classOutline, classChildren, methodDeclaration);
418 } 479 }
419 } 480 }
420 classOutline.children = new List.from(classChildren); 481 classOutline.children = new List.from(classChildren);
421 } 482 }
483 if (unitMember is TopLevelVariableDeclaration) {
484 TopLevelVariableDeclaration fieldDeclaration = unitMember;
485 VariableDeclarationList fields = fieldDeclaration.variables;
486 if (fields != null) {
487 TypeName fieldType = fields.type;
488 String fieldTypeName = fieldType != null ? fieldType.toSource() : "";
489 for (VariableDeclaration field in fields.variables) {
490 _newVariableOutline(unitOutline, unitChildren, fieldTypeName, psi.El ementKind.TOP_LEVEL_VARIABLE, field, false);
491 }
492 }
493 }
422 if (unitMember is FunctionDeclaration) { 494 if (unitMember is FunctionDeclaration) {
423 FunctionDeclaration functionDeclaration = unitMember; 495 FunctionDeclaration functionDeclaration = unitMember;
424 _newFunctionOutline(unitOutline, unitChildren, functionDeclaration); 496 _newFunctionOutline(unitOutline, unitChildren, functionDeclaration);
425 } 497 }
426 if (unitMember is ClassTypeAlias) { 498 if (unitMember is ClassTypeAlias) {
427 ClassTypeAlias alias = unitMember; 499 ClassTypeAlias alias = unitMember;
428 _newClassTypeAlias(unitOutline, unitChildren, alias); 500 _newClassTypeAlias(unitOutline, unitChildren, alias);
429 } 501 }
430 if (unitMember is FunctionTypeAlias) { 502 if (unitMember is FunctionTypeAlias) {
431 FunctionTypeAlias alias = unitMember; 503 FunctionTypeAlias alias = unitMember;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 nameLength = name.length; 540 nameLength = name.length;
469 } else { 541 } else {
470 name = "??????????"; 542 name = "??????????";
471 nameOffset = nameNode.offset; 543 nameOffset = nameNode.offset;
472 nameLength = nameNode.length; 544 nameLength = nameNode.length;
473 } 545 }
474 } 546 }
475 // add a new outline 547 // add a new outline
476 FunctionExpression functionExpression = arguments[1] as FunctionExpressi on; 548 FunctionExpression functionExpression = arguments[1] as FunctionExpressi on;
477 SourceRegionImpl sourceRegion = new SourceRegionImpl(node.offset, node.l ength); 549 SourceRegionImpl sourceRegion = new SourceRegionImpl(node.offset, node.l ength);
478 ElementImpl element = new ElementImpl(null, _source, unitTestKind, name, nameOffset, nameLength, null, null, false, false, false); 550 ElementImpl element = new ElementImpl(_contextId, null, _source, unitTes tKind, name, nameOffset, nameLength, null, null, false, false, false);
479 OutlineImpl outline = new OutlineImpl(parent, element, sourceRegion); 551 OutlineImpl outline = new OutlineImpl(parent, element, sourceRegion);
480 children.add(outline); 552 children.add(outline);
481 _addLocalFunctionOutlines(outline, functionExpression.body); 553 _addLocalFunctionOutlines(outline, functionExpression.body);
482 return true; 554 return true;
483 } 555 }
484 } 556 }
485 return false; 557 return false;
486 } 558 }
487 559
488 /** 560 /**
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 return libraryElement != null && _UNITTEST_LIBRARY == libraryElement.n ame; 619 return libraryElement != null && _UNITTEST_LIBRARY == libraryElement.n ame;
548 } 620 }
549 } 621 }
550 } 622 }
551 return false; 623 return false;
552 } 624 }
553 625
554 OutlineImpl _newClassOutline(psi.Outline unitOutline, List<psi.Outline> unitCh ildren, ClassDeclaration classDeclaration) { 626 OutlineImpl _newClassOutline(psi.Outline unitOutline, List<psi.Outline> unitCh ildren, ClassDeclaration classDeclaration) {
555 SimpleIdentifier nameNode = classDeclaration.name; 627 SimpleIdentifier nameNode = classDeclaration.name;
556 String name = nameNode.name; 628 String name = nameNode.name;
557 ElementImpl element = new ElementImpl(ElementImpl.createId(classDeclaration. element), _source, psi.ElementKind.CLASS, name, nameNode.offset, name.length, nu ll, null, classDeclaration.isAbstract, false, StringUtilities.startsWithChar(nam e, 0x5F)); 629 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(class Declaration.element), _source, psi.ElementKind.CLASS, name, nameNode.offset, nam e.length, null, null, classDeclaration.isAbstract, false, StringUtilities.starts WithChar(name, 0x5F));
558 psi.SourceRegion sourceRegion = _getSourceRegion(classDeclaration); 630 psi.SourceRegion sourceRegion = _getSourceRegion(classDeclaration);
559 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion); 631 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion);
560 unitChildren.add(outline); 632 unitChildren.add(outline);
561 return outline; 633 return outline;
562 } 634 }
563 635
564 void _newClassTypeAlias(psi.Outline unitOutline, List<psi.Outline> unitChildre n, ClassTypeAlias alias) { 636 void _newClassTypeAlias(psi.Outline unitOutline, List<psi.Outline> unitChildre n, ClassTypeAlias alias) {
565 SimpleIdentifier nameNode = alias.name; 637 SimpleIdentifier nameNode = alias.name;
566 String name = nameNode.name; 638 String name = nameNode.name;
567 ElementImpl element = new ElementImpl(ElementImpl.createId(alias.element), _ source, psi.ElementKind.CLASS_TYPE_ALIAS, name, nameNode.offset, nameNode.length , null, null, alias.isAbstract, false, StringUtilities.startsWithChar(name, 0x5F )); 639 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(alias .element), _source, psi.ElementKind.CLASS_TYPE_ALIAS, name, nameNode.offset, nam eNode.length, null, null, alias.isAbstract, false, StringUtilities.startsWithCha r(name, 0x5F));
568 psi.SourceRegion sourceRegion = _getSourceRegion(alias); 640 psi.SourceRegion sourceRegion = _getSourceRegion(alias);
569 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion); 641 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion);
570 unitChildren.add(outline); 642 unitChildren.add(outline);
571 } 643 }
572 644
573 void _newConstructorOutline(OutlineImpl classOutline, List<psi.Outline> childr en, ConstructorDeclaration constructorDeclaration) { 645 void _newConstructorOutline(OutlineImpl classOutline, List<psi.Outline> childr en, ConstructorDeclaration constructorDeclaration) {
574 Identifier returnType = constructorDeclaration.returnType; 646 Identifier returnType = constructorDeclaration.returnType;
575 String name = returnType.name; 647 String name = returnType.name;
576 int offset = returnType.offset; 648 int offset = returnType.offset;
577 int length = returnType.length; 649 int length = returnType.length;
578 bool isPrivate = false; 650 bool isPrivate = false;
579 SimpleIdentifier constructorNameNode = constructorDeclaration.name; 651 SimpleIdentifier constructorNameNode = constructorDeclaration.name;
580 if (constructorNameNode != null) { 652 if (constructorNameNode != null) {
581 String constructorName = constructorNameNode.name; 653 String constructorName = constructorNameNode.name;
582 isPrivate = StringUtilities.startsWithChar(constructorName, 0x5F); 654 isPrivate = StringUtilities.startsWithChar(constructorName, 0x5F);
583 name += ".${constructorName}"; 655 name += ".${constructorName}";
584 offset = constructorNameNode.offset; 656 offset = constructorNameNode.offset;
585 length = constructorNameNode.length; 657 length = constructorNameNode.length;
586 } 658 }
587 FormalParameterList parameters = constructorDeclaration.parameters; 659 FormalParameterList parameters = constructorDeclaration.parameters;
588 ElementImpl element = new ElementImpl(ElementImpl.createId(constructorDeclar ation.element), _source, psi.ElementKind.CONSTRUCTOR, name, offset, length, para meters != null ? parameters.toSource() : "", null, false, false, isPrivate); 660 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(const ructorDeclaration.element), _source, psi.ElementKind.CONSTRUCTOR, name, offset, length, parameters != null ? parameters.toSource() : "", null, false, false, isP rivate);
589 psi.SourceRegion sourceRegion = _getSourceRegion(constructorDeclaration); 661 psi.SourceRegion sourceRegion = _getSourceRegion(constructorDeclaration);
590 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion); 662 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion);
591 children.add(outline); 663 children.add(outline);
592 _addLocalFunctionOutlines(outline, constructorDeclaration.body); 664 _addLocalFunctionOutlines(outline, constructorDeclaration.body);
593 } 665 }
594 666
595 void _newField(OutlineImpl classOutline, List<psi.Outline> children, String fi eldTypeName, VariableDeclaration field, bool isStatic) {
596 SimpleIdentifier nameNode = field.name;
597 String name = nameNode.name;
598 ElementImpl element = new ElementImpl(ElementImpl.createId(field.element), _ source, psi.ElementKind.FIELD, name, nameNode.offset, nameNode.length, null, fie ldTypeName, false, isStatic, StringUtilities.startsWithChar(name, 0x5F));
599 psi.SourceRegion sourceRegion = _getSourceRegion(field);
600 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion);
601 children.add(outline);
602 }
603
604 void _newFunctionOutline(psi.Outline parent, List<psi.Outline> children, Funct ionDeclaration functionDeclaration) { 667 void _newFunctionOutline(psi.Outline parent, List<psi.Outline> children, Funct ionDeclaration functionDeclaration) {
605 TypeName returnType = functionDeclaration.returnType; 668 TypeName returnType = functionDeclaration.returnType;
606 SimpleIdentifier nameNode = functionDeclaration.name; 669 SimpleIdentifier nameNode = functionDeclaration.name;
607 String name = nameNode.name; 670 String name = nameNode.name;
608 FunctionExpression functionExpression = functionDeclaration.functionExpressi on; 671 FunctionExpression functionExpression = functionDeclaration.functionExpressi on;
609 FormalParameterList parameters = functionExpression.parameters; 672 FormalParameterList parameters = functionExpression.parameters;
610 psi.ElementKind kind; 673 psi.ElementKind kind;
611 if (functionDeclaration.isGetter) { 674 if (functionDeclaration.isGetter) {
612 kind = psi.ElementKind.GETTER; 675 kind = psi.ElementKind.GETTER;
613 } else if (functionDeclaration.isSetter) { 676 } else if (functionDeclaration.isSetter) {
614 kind = psi.ElementKind.SETTER; 677 kind = psi.ElementKind.SETTER;
615 } else { 678 } else {
616 kind = psi.ElementKind.FUNCTION; 679 kind = psi.ElementKind.FUNCTION;
617 } 680 }
618 ElementImpl element = new ElementImpl(ElementImpl.createId(functionDeclarati on.element), _source, kind, name, nameNode.offset, nameNode.length, parameters ! = null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, false, StringUtilities.startsWithChar(name, 0x5F)); 681 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(funct ionDeclaration.element), _source, kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType .toSource() : "", false, false, StringUtilities.startsWithChar(name, 0x5F));
619 psi.SourceRegion sourceRegion = _getSourceRegion(functionDeclaration); 682 psi.SourceRegion sourceRegion = _getSourceRegion(functionDeclaration);
620 OutlineImpl outline = new OutlineImpl(parent, element, sourceRegion); 683 OutlineImpl outline = new OutlineImpl(parent, element, sourceRegion);
621 children.add(outline); 684 children.add(outline);
622 _addLocalFunctionOutlines(outline, functionExpression.body); 685 _addLocalFunctionOutlines(outline, functionExpression.body);
623 } 686 }
624 687
625 void _newFunctionTypeAliasOutline(psi.Outline unitOutline, List<psi.Outline> u nitChildren, FunctionTypeAlias alias) { 688 void _newFunctionTypeAliasOutline(psi.Outline unitOutline, List<psi.Outline> u nitChildren, FunctionTypeAlias alias) {
626 TypeName returnType = alias.returnType; 689 TypeName returnType = alias.returnType;
627 SimpleIdentifier nameNode = alias.name; 690 SimpleIdentifier nameNode = alias.name;
628 String name = nameNode.name; 691 String name = nameNode.name;
629 FormalParameterList parameters = alias.parameters; 692 FormalParameterList parameters = alias.parameters;
630 ElementImpl element = new ElementImpl(ElementImpl.createId(alias.element), _ source, psi.ElementKind.FUNCTION_TYPE_ALIAS, name, nameNode.offset, nameNode.len gth, parameters != null ? parameters.toSource() : "", returnType != null ? retur nType.toSource() : "", false, false, StringUtilities.startsWithChar(name, 0x5F)) ; 693 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(alias .element), _source, psi.ElementKind.FUNCTION_TYPE_ALIAS, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, false, StringUtilities.startsWithChar( name, 0x5F));
631 psi.SourceRegion sourceRegion = _getSourceRegion(alias); 694 psi.SourceRegion sourceRegion = _getSourceRegion(alias);
632 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion); 695 OutlineImpl outline = new OutlineImpl(unitOutline, element, sourceRegion);
633 unitChildren.add(outline); 696 unitChildren.add(outline);
634 } 697 }
635 698
636 void _newMethodOutline(OutlineImpl classOutline, List<psi.Outline> children, M ethodDeclaration methodDeclaration) { 699 void _newMethodOutline(OutlineImpl classOutline, List<psi.Outline> children, M ethodDeclaration methodDeclaration) {
637 TypeName returnType = methodDeclaration.returnType; 700 TypeName returnType = methodDeclaration.returnType;
638 SimpleIdentifier nameNode = methodDeclaration.name; 701 SimpleIdentifier nameNode = methodDeclaration.name;
639 String name = nameNode.name; 702 String name = nameNode.name;
640 FormalParameterList parameters = methodDeclaration.parameters; 703 FormalParameterList parameters = methodDeclaration.parameters;
641 psi.ElementKind kind; 704 psi.ElementKind kind;
642 if (methodDeclaration.isGetter) { 705 if (methodDeclaration.isGetter) {
643 kind = psi.ElementKind.GETTER; 706 kind = psi.ElementKind.GETTER;
644 } else if (methodDeclaration.isSetter) { 707 } else if (methodDeclaration.isSetter) {
645 kind = psi.ElementKind.SETTER; 708 kind = psi.ElementKind.SETTER;
646 } else { 709 } else {
647 kind = psi.ElementKind.METHOD; 710 kind = psi.ElementKind.METHOD;
648 } 711 }
649 ElementImpl element = new ElementImpl(ElementImpl.createId(methodDeclaration .element), _source, kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", methodDeclaration.isAbstract, methodDeclaration.isStatic, StringUtilities.st artsWithChar(name, 0x5F)); 712 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(metho dDeclaration.element), _source, kind, name, nameNode.offset, nameNode.length, pa rameters != null ? parameters.toSource() : "", returnType != null ? returnType.t oSource() : "", methodDeclaration.isAbstract, methodDeclaration.isStatic, String Utilities.startsWithChar(name, 0x5F));
650 psi.SourceRegion sourceRegion = _getSourceRegion(methodDeclaration); 713 psi.SourceRegion sourceRegion = _getSourceRegion(methodDeclaration);
651 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion); 714 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion);
652 children.add(outline); 715 children.add(outline);
653 _addLocalFunctionOutlines(outline, methodDeclaration.body); 716 _addLocalFunctionOutlines(outline, methodDeclaration.body);
654 } 717 }
655 718
656 OutlineImpl _newUnitOutline() { 719 OutlineImpl _newUnitOutline() {
657 ElementImpl element = new ElementImpl(ElementImpl.createId(_unit.element), _ source, psi.ElementKind.COMPILATION_UNIT, null, 0, 0, null, null, false, false, false); 720 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(_unit .element), _source, psi.ElementKind.COMPILATION_UNIT, null, 0, 0, null, null, fa lse, false, false);
658 return new OutlineImpl(null, element, new SourceRegionImpl(_unit.offset, _un it.length)); 721 return new OutlineImpl(null, element, new SourceRegionImpl(_unit.offset, _un it.length));
659 } 722 }
723
724 void _newVariableOutline(OutlineImpl classOutline, List<psi.Outline> children, String typeName, psi.ElementKind kind, VariableDeclaration variable, bool isSta tic) {
725 SimpleIdentifier nameNode = variable.name;
726 String name = nameNode.name;
727 ElementImpl element = new ElementImpl(_contextId, ElementImpl.createId(varia ble.element), _source, kind, name, nameNode.offset, nameNode.length, null, typeN ame, false, isStatic, StringUtilities.startsWithChar(name, 0x5F));
728 psi.SourceRegion sourceRegion = _getSourceRegion(variable);
729 OutlineImpl outline = new OutlineImpl(classOutline, element, sourceRegion);
730 children.add(outline);
731 }
660 } 732 }
661 733
662 /** 734 /**
663 * A concrete implementation of [Element]. 735 * A concrete implementation of [Element].
664 */ 736 */
665 class ElementImpl implements psi.Element { 737 class ElementImpl implements psi.Element {
666 /** 738 /**
667 * Creates an [ElementImpl] instance for the given 739 * Creates an [ElementImpl] instance for the given
668 * [com.google.dart.engine.element.Element]. 740 * [com.google.dart.engine.element.Element].
669 */ 741 */
670 static ElementImpl create(pae.Element element) { 742 static ElementImpl create(String contextId, pae.Element element) {
743 if (element == null) {
744 return null;
745 }
671 // prepare name 746 // prepare name
672 String name = element.displayName; 747 String name = element.displayName;
673 int nameOffset = element.nameOffset; 748 int nameOffset = element.nameOffset;
674 int nameLength = name != null ? name.length : 0; 749 int nameLength = name != null ? name.length : 0;
675 // prepare element kind specific information 750 // prepare element kind specific information
676 psi.ElementKind outlineKind; 751 psi.ElementKind outlineKind;
677 bool isAbstract = false; 752 bool isAbstract = false;
678 bool isStatic = false; 753 bool isStatic = false;
679 bool isPrivate = element.isPrivate; 754 bool isPrivate = element.isPrivate;
680 while (true) { 755 while (true) {
681 if (element.kind == pae.ElementKind.CLASS) { 756 if (element.kind == pae.ElementKind.CLASS) {
682 outlineKind = psi.ElementKind.CLASS; 757 outlineKind = psi.ElementKind.CLASS;
683 isAbstract = (element as pae.ClassElement).isAbstract; 758 isAbstract = (element as pae.ClassElement).isAbstract;
684 } else if (element.kind == pae.ElementKind.COMPILATION_UNIT) { 759 } else if (element.kind == pae.ElementKind.COMPILATION_UNIT) {
685 outlineKind = psi.ElementKind.COMPILATION_UNIT; 760 outlineKind = psi.ElementKind.COMPILATION_UNIT;
686 nameOffset = -1; 761 nameOffset = -1;
687 nameLength = 0; 762 nameLength = 0;
688 } else if (element.kind == pae.ElementKind.CONSTRUCTOR) { 763 } else if (element.kind == pae.ElementKind.CONSTRUCTOR) {
689 outlineKind = psi.ElementKind.CONSTRUCTOR; 764 outlineKind = psi.ElementKind.CONSTRUCTOR;
690 String className = element.enclosingElement.name; 765 String className = element.enclosingElement.name;
691 if (name.length != 0) { 766 if (name.length != 0) {
692 name = "${className}.${name}"; 767 name = "${className}.${name}";
693 } else { 768 } else {
694 name = className; 769 name = className;
695 } 770 }
696 } else if (element.kind == pae.ElementKind.FUNCTION) { 771 } else if (element.kind == pae.ElementKind.FUNCTION) {
697 outlineKind = psi.ElementKind.FUNCTION; 772 outlineKind = psi.ElementKind.FUNCTION;
773 } else if (element.kind == pae.ElementKind.GETTER) {
774 outlineKind = psi.ElementKind.GETTER;
698 } else if (element.kind == pae.ElementKind.FUNCTION_TYPE_ALIAS) { 775 } else if (element.kind == pae.ElementKind.FUNCTION_TYPE_ALIAS) {
699 outlineKind = psi.ElementKind.FUNCTION_TYPE_ALIAS; 776 outlineKind = psi.ElementKind.FUNCTION_TYPE_ALIAS;
700 } else if (element.kind == pae.ElementKind.LIBRARY) { 777 } else if (element.kind == pae.ElementKind.LIBRARY) {
701 outlineKind = psi.ElementKind.LIBRARY; 778 outlineKind = psi.ElementKind.LIBRARY;
702 } else if (element.kind == pae.ElementKind.METHOD) { 779 } else if (element.kind == pae.ElementKind.METHOD) {
703 outlineKind = psi.ElementKind.METHOD; 780 outlineKind = psi.ElementKind.METHOD;
704 isAbstract = (element as pae.MethodElement).isAbstract; 781 isAbstract = (element as pae.MethodElement).isAbstract;
782 } else if (element.kind == pae.ElementKind.SETTER) {
783 outlineKind = psi.ElementKind.SETTER;
705 } else { 784 } else {
706 outlineKind = psi.ElementKind.UNKNOWN; 785 outlineKind = psi.ElementKind.UNKNOWN;
707 } 786 }
708 break; 787 break;
709 } 788 }
710 // extract return type and parameters from toString() 789 // extract return type and parameters from toString()
711 // TODO(scheglov) we need a way to get this information directly from an Ele ment 790 // TODO(scheglov) we need a way to get this information directly from an Ele ment
712 String parameters; 791 String parameters;
713 String returnType; 792 String returnType;
714 { 793 {
715 String str = element.toString(); 794 String str = element.toString();
716 // return type 795 // return type
717 String rightArrow = pae.Element.RIGHT_ARROW; 796 String rightArrow = pae.Element.RIGHT_ARROW;
718 int returnIndex = str.lastIndexOf(rightArrow); 797 int returnIndex = str.lastIndexOf(rightArrow);
719 if (returnIndex != -1) { 798 if (returnIndex != -1) {
720 returnType = str.substring(returnIndex + rightArrow.length); 799 returnType = str.substring(returnIndex + rightArrow.length);
721 str = str.substring(0, returnIndex); 800 str = str.substring(0, returnIndex);
722 } else { 801 } else {
723 returnType = null; 802 returnType = null;
724 } 803 }
725 // parameters 804 // parameters
726 int parametersIndex = str.indexOf("("); 805 int parametersIndex = str.indexOf("(");
727 if (parametersIndex != -1) { 806 if (parametersIndex != -1) {
728 parameters = str.substring(parametersIndex); 807 parameters = str.substring(parametersIndex);
729 } else { 808 } else {
730 parameters = null; 809 parameters = null;
731 } 810 }
732 } 811 }
733 // new element 812 // new element
734 return new ElementImpl(createId(element), element.source, outlineKind, name, nameOffset, nameLength, parameters, returnType, isAbstract, isStatic, isPrivate ); 813 return new ElementImpl(contextId, createId(element), element.source, outline Kind, name, nameOffset, nameLength, parameters, returnType, isAbstract, isStatic , isPrivate);
735 } 814 }
736 815
737 /** 816 /**
738 * Returns an identifier of the given [Element], maybe `null` if `null` given. 817 * Returns an identifier of the given [Element], maybe `null` if `null` given.
739 */ 818 */
740 static String createId(pae.Element element) { 819 static String createId(pae.Element element) {
741 if (element == null) { 820 if (element == null) {
742 return null; 821 return null;
743 } 822 }
744 return element.location.encoding; 823 return element.location.encoding;
745 } 824 }
746 825
826 final String contextId;
827
747 final String id; 828 final String id;
748 829
749 final Source source; 830 final Source source;
750 831
751 final psi.ElementKind kind; 832 final psi.ElementKind kind;
752 833
753 final String name; 834 final String name;
754 835
755 final int offset; 836 final int offset;
756 837
757 final int length; 838 final int length;
758 839
759 final String parameters; 840 final String parameters;
760 841
761 final String returnType; 842 final String returnType;
762 843
763 final bool isAbstract; 844 final bool isAbstract;
764 845
765 final bool isPrivate; 846 final bool isPrivate;
766 847
767 final bool isStatic; 848 final bool isStatic;
768 849
769 ElementImpl(this.id, this.source, this.kind, this.name, this.offset, this.leng th, this.parameters, this.returnType, this.isAbstract, this.isStatic, this.isPri vate); 850 ElementImpl(this.contextId, this.id, this.source, this.kind, this.name, this.o ffset, this.length, this.parameters, this.returnType, this.isAbstract, this.isSt atic, this.isPrivate);
770 851
771 @override 852 @override
772 bool operator ==(Object obj) { 853 bool operator ==(Object obj) {
773 if (identical(obj, this)) { 854 if (identical(obj, this)) {
774 return true; 855 return true;
775 } 856 }
776 if (obj is! ElementImpl) { 857 if (obj is! ElementImpl) {
777 return false; 858 return false;
778 } 859 }
779 ElementImpl other = obj as ElementImpl; 860 ElementImpl other = obj as ElementImpl;
(...skipping 21 matching lines...) Expand all
801 builder.append(length); 882 builder.append(length);
802 builder.append(", parameters="); 883 builder.append(", parameters=");
803 builder.append(parameters); 884 builder.append(parameters);
804 builder.append(", return="); 885 builder.append(", return=");
805 builder.append(returnType); 886 builder.append(returnType);
806 builder.append("]"); 887 builder.append("]");
807 return builder.toString(); 888 return builder.toString();
808 } 889 }
809 } 890 }
810 891
892 class GeneralizingElementVisitor_TypeHierarchyComputer_findEngineElement extends pae.GeneralizingElementVisitor<Object> {
893 int nameOffset = 0;
894
895 List<pae.Element> result;
896
897 GeneralizingElementVisitor_TypeHierarchyComputer_findEngineElement(this.nameOf fset, this.result) : super();
898
899 @override
900 Object visitElement(pae.Element element) {
901 if (element.nameOffset == nameOffset) {
902 result[0] = element;
903 }
904 return super.visitElement(element);
905 }
906 }
907
811 /** 908 /**
812 * A concrete implementation of [HighlightRegion]. 909 * A concrete implementation of [HighlightRegion].
813 */ 910 */
814 class HighlightRegionImpl extends SourceRegionImpl implements psi.HighlightRegio n { 911 class HighlightRegionImpl extends SourceRegionImpl implements psi.HighlightRegio n {
815 final psi.HighlightType type; 912 final psi.HighlightType type;
816 913
817 HighlightRegionImpl(int offset, int length, this.type) : super(offset, length) ; 914 HighlightRegionImpl(int offset, int length, this.type) : super(offset, length) ;
818 915
819 @override 916 @override
820 String toString() { 917 String toString() {
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 return super.visitAssignmentExpression(node); 1172 return super.visitAssignmentExpression(node);
1076 } 1173 }
1077 1174
1078 @override 1175 @override
1079 Object visitBinaryExpression(BinaryExpression node) { 1176 Object visitBinaryExpression(BinaryExpression node) {
1080 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement); 1177 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
1081 return super.visitBinaryExpression(node); 1178 return super.visitBinaryExpression(node);
1082 } 1179 }
1083 1180
1084 @override 1181 @override
1182 Object visitConstructorDeclaration(ConstructorDeclaration node) {
1183 // associate constructor with "T" or "T.name"
1184 {
1185 AstNode firstNode = node.returnType;
1186 AstNode lastNode = node.name;
1187 if (lastNode == null) {
1188 lastNode = firstNode;
1189 }
1190 if (firstNode != null && lastNode != null) {
1191 DartUnitNavigationComputer_this._addRegion_nodeStart_nodeEnd(firstNode, lastNode, node.element);
1192 }
1193 }
1194 return super.visitConstructorDeclaration(node);
1195 }
1196
1197 @override
1085 Object visitExportDirective(ExportDirective node) { 1198 Object visitExportDirective(ExportDirective node) {
1086 pae.ExportElement exportElement = node.element; 1199 pae.ExportElement exportElement = node.element;
1087 if (exportElement != null) { 1200 if (exportElement != null) {
1088 pae.Element element = exportElement.exportedLibrary; 1201 pae.Element element = exportElement.exportedLibrary;
1089 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element); 1202 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element);
1090 } 1203 }
1091 return super.visitExportDirective(node); 1204 return super.visitExportDirective(node);
1092 } 1205 }
1093 1206
1094 @override 1207 @override
1095 Object visitImportDirective(ImportDirective node) { 1208 Object visitImportDirective(ImportDirective node) {
1096 pae.ImportElement importElement = node.element; 1209 pae.ImportElement importElement = node.element;
1097 if (importElement != null) { 1210 if (importElement != null) {
1098 pae.Element element = importElement.importedLibrary; 1211 pae.Element element = importElement.importedLibrary;
1099 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element); 1212 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword , node.uri, element);
1100 } 1213 }
1101 return super.visitImportDirective(node); 1214 return super.visitImportDirective(node);
1102 } 1215 }
1103 1216
1104 @override 1217 @override
1105 Object visitIndexExpression(IndexExpression node) { 1218 Object visitIndexExpression(IndexExpression node) {
1106 DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.b estElement); 1219 DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.b estElement);
1107 return super.visitIndexExpression(node); 1220 return super.visitIndexExpression(node);
1108 } 1221 }
1109 1222
1110 @override 1223 @override
1224 Object visitInstanceCreationExpression(InstanceCreationExpression node) {
1225 DartUnitNavigationComputer_this._addRegion_nodeStart_nodeStart(node, node.ar gumentList, node.staticElement);
1226 return super.visitInstanceCreationExpression(node);
1227 }
1228
1229 @override
1111 Object visitPartDirective(PartDirective node) { 1230 Object visitPartDirective(PartDirective node) {
1112 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, node.element); 1231 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, node.element);
1113 return super.visitPartDirective(node); 1232 return super.visitPartDirective(node);
1114 } 1233 }
1115 1234
1116 @override 1235 @override
1117 Object visitPartOfDirective(PartOfDirective node) { 1236 Object visitPartOfDirective(PartOfDirective node) {
1118 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.libraryName, node.element); 1237 DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.libraryName, node.element);
1119 return super.visitPartOfDirective(node); 1238 return super.visitPartOfDirective(node);
1120 } 1239 }
1121 1240
1122 @override 1241 @override
1123 Object visitPostfixExpression(PostfixExpression node) { 1242 Object visitPostfixExpression(PostfixExpression node) {
1124 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement); 1243 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
1125 return super.visitPostfixExpression(node); 1244 return super.visitPostfixExpression(node);
1126 } 1245 }
1127 1246
1128 @override 1247 @override
1129 Object visitPrefixExpression(PrefixExpression node) { 1248 Object visitPrefixExpression(PrefixExpression node) {
1130 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement); 1249 DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestE lement);
1131 return super.visitPrefixExpression(node); 1250 return super.visitPrefixExpression(node);
1132 } 1251 }
1133 1252
1134 @override 1253 @override
1135 Object visitSimpleIdentifier(SimpleIdentifier node) { 1254 Object visitSimpleIdentifier(SimpleIdentifier node) {
1136 DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement); 1255 if (node.parent is ConstructorDeclaration) {
1256 } else {
1257 DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement);
1258 }
1137 return super.visitSimpleIdentifier(node); 1259 return super.visitSimpleIdentifier(node);
1138 } 1260 }
1139 } 1261 }
1140 1262
1141 class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines exten ds RecursiveAstVisitor<Object> { 1263 class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines exten ds RecursiveAstVisitor<Object> {
1142 final DartUnitOutlineComputer DartUnitOutlineComputer_this; 1264 final DartUnitOutlineComputer DartUnitOutlineComputer_this;
1143 1265
1144 OutlineImpl parent; 1266 OutlineImpl parent;
1145 1267
1146 List<psi.Outline> localOutlines; 1268 List<psi.Outline> localOutlines;
(...skipping 23 matching lines...) Expand all
1170 final List<psi.Element> path; 1292 final List<psi.Element> path;
1171 1293
1172 final Source source; 1294 final Source source;
1173 1295
1174 final psi.SearchResultKind kind; 1296 final psi.SearchResultKind kind;
1175 1297
1176 final int offset; 1298 final int offset;
1177 1299
1178 final int length; 1300 final int length;
1179 1301
1180 SearchResultImpl(this.path, this.source, this.kind, this.offset, this.length); 1302 final bool isPotential;
1303
1304 SearchResultImpl(this.path, this.source, this.kind, this.offset, this.length, this.isPotential);
1181 1305
1182 @override 1306 @override
1183 String toString() { 1307 String toString() {
1184 JavaStringBuilder builder = new JavaStringBuilder(); 1308 JavaStringBuilder builder = new JavaStringBuilder();
1185 builder.append("[source="); 1309 builder.append("[source=");
1186 builder.append(source); 1310 builder.append(source);
1187 builder.append(", kind="); 1311 builder.append(", kind=");
1188 builder.append(kind); 1312 builder.append(kind);
1189 builder.append(", offset="); 1313 builder.append(", offset=");
1190 builder.append(offset); 1314 builder.append(offset);
1191 builder.append(", length="); 1315 builder.append(", length=");
1192 builder.append(length); 1316 builder.append(length);
1317 builder.append(", potential=");
1318 builder.append(isPotential);
1193 builder.append(", path="); 1319 builder.append(", path=");
1194 builder.append(path); 1320 builder.append(path);
1195 builder.append("]"); 1321 builder.append("]");
1196 return builder.toString(); 1322 return builder.toString();
1197 } 1323 }
1198 } 1324 }
1199 1325
1200 /** 1326 /**
1201 * A concrete implementation of [SourceRegion]. 1327 * A concrete implementation of [SourceRegion].
1202 */ 1328 */
(...skipping 25 matching lines...) Expand all
1228 @override 1354 @override
1229 String toString() { 1355 String toString() {
1230 JavaStringBuilder builder = new JavaStringBuilder(); 1356 JavaStringBuilder builder = new JavaStringBuilder();
1231 builder.append("[offset="); 1357 builder.append("[offset=");
1232 builder.append(offset); 1358 builder.append(offset);
1233 builder.append(", length="); 1359 builder.append(", length=");
1234 builder.append(length); 1360 builder.append(length);
1235 builder.append("]"); 1361 builder.append("]");
1236 return builder.toString(); 1362 return builder.toString();
1237 } 1363 }
1364 }
1365
1366 /**
1367 * A concrete implementation of [TypeHierarchyItem].
1368 */
1369 class TypeHierarchyItemImpl implements psi.TypeHierarchyItem {
1370 final String name;
1371
1372 final psi.Element classElement;
1373
1374 final psi.Element memberElement;
1375
1376 final psi.TypeHierarchyItem extendedType;
1377
1378 final List<psi.TypeHierarchyItem> mixedTypes;
1379
1380 final List<psi.TypeHierarchyItem> implementedTypes;
1381
1382 List<psi.TypeHierarchyItem> subTypes = psi.TypeHierarchyItem.EMPTY_ARRAY;
1383
1384 TypeHierarchyItemImpl(this.name, this.classElement, this.memberElement, this.e xtendedType, this.mixedTypes, this.implementedTypes);
1385
1386 @override
1387 String toString() {
1388 JavaStringBuilder builder = new JavaStringBuilder();
1389 builder.append("[name=");
1390 builder.append(name);
1391 builder.append(", classElement=");
1392 builder.append(classElement);
1393 builder.append(", memberElement=");
1394 builder.append(memberElement);
1395 builder.append(", extendedType=");
1396 builder.append(extendedType);
1397 builder.append(", mixedTypes=[");
1398 builder.append(StringUtils.join(mixedTypes, ", "));
1399 builder.append("], implementedTypes=[");
1400 builder.append(StringUtils.join(implementedTypes, ", "));
1401 builder.append("], subTypes=[");
1402 builder.append(StringUtils.join(subTypes, ", "));
1403 builder.append("]]");
1404 return builder.toString();
1405 }
1238 } 1406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698