| Index: pkg/analysis_server/lib/src/generated/service_computers.dart
|
| diff --git a/pkg/analysis_server/lib/src/generated/service_computers.dart b/pkg/analysis_server/lib/src/generated/service_computers.dart
|
| index a6a81f23dd60805d9947367d1e84a3c857d85ee0..3a8334074bbf89c2d07618136b0eb368fa26f5e1 100644
|
| --- a/pkg/analysis_server/lib/src/generated/service_computers.dart
|
| +++ b/pkg/analysis_server/lib/src/generated/service_computers.dart
|
| @@ -16,245 +16,6 @@ import 'package:analyzer/src/generated/element.dart';
|
| import 'service_interfaces.dart';
|
|
|
| /**
|
| - * A concrete implementation of [SourceRegion].
|
| - */
|
| -class SourceRegionImpl implements SourceRegion {
|
| - final int offset;
|
| -
|
| - final int length;
|
| -
|
| - SourceRegionImpl(this.offset, this.length);
|
| -
|
| - @override
|
| - bool containsInclusive(int x) => offset <= x && x <= offset + length;
|
| -
|
| - @override
|
| - bool operator ==(Object obj) {
|
| - if (identical(obj, this)) {
|
| - return true;
|
| - }
|
| - if (obj is! SourceRegion) {
|
| - return false;
|
| - }
|
| - SourceRegion other = obj as SourceRegion;
|
| - return other.offset == offset && other.length == length;
|
| - }
|
| -
|
| - @override
|
| - int get hashCode => ObjectUtilities.combineHashCodes(offset, length);
|
| -
|
| - @override
|
| - String toString() {
|
| - JavaStringBuilder builder = new JavaStringBuilder();
|
| - builder.append("[offset=");
|
| - builder.append(offset);
|
| - builder.append(", length=");
|
| - builder.append(length);
|
| - builder.append("]");
|
| - return builder.toString();
|
| - }
|
| -}
|
| -
|
| -/**
|
| - * A concrete implementation of [Outline].
|
| - */
|
| -class OutlineImpl implements Outline {
|
| - final Outline parent;
|
| -
|
| - final SourceRegion sourceRegion;
|
| -
|
| - final OutlineKind kind;
|
| -
|
| - final String name;
|
| -
|
| - final int offset;
|
| -
|
| - final int length;
|
| -
|
| - final String parameters;
|
| -
|
| - final String returnType;
|
| -
|
| - final bool isAbstract;
|
| -
|
| - final bool isStatic;
|
| -
|
| - List<Outline> children = Outline.EMPTY_ARRAY;
|
| -
|
| - OutlineImpl(this.parent, this.sourceRegion, this.kind, this.name, this.offset, this.length, this.parameters, this.returnType, this.isAbstract, this.isStatic);
|
| -
|
| - @override
|
| - bool operator ==(Object obj) {
|
| - if (identical(obj, this)) {
|
| - return true;
|
| - }
|
| - if (obj is! OutlineImpl) {
|
| - return false;
|
| - }
|
| - OutlineImpl other = obj as OutlineImpl;
|
| - return (other.parent == parent) && other.offset == offset;
|
| - }
|
| -
|
| - @override
|
| - int get hashCode => offset;
|
| -
|
| - @override
|
| - bool get isPrivate => StringUtilities.startsWithChar(name, 0x5F);
|
| -
|
| - @override
|
| - String toString() {
|
| - JavaStringBuilder builder = new JavaStringBuilder();
|
| - builder.append("[name=");
|
| - builder.append(name);
|
| - builder.append(", kind=");
|
| - builder.append(kind);
|
| - builder.append(", offset=");
|
| - builder.append(offset);
|
| - builder.append(", length=");
|
| - builder.append(length);
|
| - builder.append(", parameters=");
|
| - builder.append(parameters);
|
| - builder.append(", return=");
|
| - builder.append(returnType);
|
| - builder.append(", children=[");
|
| - builder.append(StringUtils.join(children, ", "));
|
| - builder.append("]]");
|
| - return builder.toString();
|
| - }
|
| -}
|
| -
|
| -/**
|
| - * A concrete implementation of [HighlightRegion].
|
| - */
|
| -class HighlightRegionImpl extends SourceRegionImpl implements HighlightRegion {
|
| - final HighlightType type;
|
| -
|
| - HighlightRegionImpl(int offset, int length, this.type) : super(offset, length);
|
| -
|
| - @override
|
| - String toString() {
|
| - JavaStringBuilder builder = new JavaStringBuilder();
|
| - builder.append("[offset=");
|
| - builder.append(offset);
|
| - builder.append(", length=");
|
| - builder.append(length);
|
| - builder.append(", type=");
|
| - builder.append(type);
|
| - builder.append("]");
|
| - return builder.toString();
|
| - }
|
| -}
|
| -
|
| -/**
|
| - * A computer for [NavigationRegion]s in a Dart [CompilationUnit].
|
| - */
|
| -class DartUnitNavigationComputer {
|
| - final CompilationUnit _unit;
|
| -
|
| - List<NavigationRegion> _regions = [];
|
| -
|
| - DartUnitNavigationComputer(this._unit);
|
| -
|
| - /**
|
| - * Returns the computed [NavigationRegion]s, not `null`.
|
| - */
|
| - List<NavigationRegion> compute() {
|
| - _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this));
|
| - return new List.from(_regions);
|
| - }
|
| -
|
| - /**
|
| - * If the given [Element] is not `null`, then creates a corresponding
|
| - * [NavigationRegion].
|
| - */
|
| - void _addRegion(int offset, int length, Element element) {
|
| - NavigationTarget target = _createTarget(element);
|
| - if (target == null) {
|
| - return;
|
| - }
|
| - _regions.add(new NavigationRegionImpl(offset, length, <NavigationTarget> [target]));
|
| - }
|
| -
|
| - /**
|
| - * If the given [Element] is not `null`, then creates a corresponding
|
| - * [NavigationRegion].
|
| - */
|
| - void _addRegionForNode(AstNode node, Element element) {
|
| - int offset = node.offset;
|
| - int length = node.length;
|
| - _addRegion(offset, length, element);
|
| - }
|
| -
|
| - /**
|
| - * If the given [Element] is not `null`, then creates a corresponding
|
| - * [NavigationRegion].
|
| - */
|
| - void _addRegionForToken(Token token, Element element) {
|
| - int offset = token.offset;
|
| - int length = token.length;
|
| - _addRegion(offset, length, element);
|
| - }
|
| -
|
| - /**
|
| - * Returns the [NavigationTarget] for the given [Element], maybe `null` if
|
| - * `null` was given.
|
| - */
|
| - NavigationTarget _createTarget(Element element) {
|
| - if (element == null) {
|
| - return null;
|
| - }
|
| - if (element is FieldFormalParameterElement) {
|
| - element = (element as FieldFormalParameterElement).field;
|
| - }
|
| - return new NavigationTargetImpl(element.source, _getElementId(element), element.nameOffset, element.displayName.length);
|
| - }
|
| -
|
| - String _getElementId(Element element) => element.location.encoding;
|
| -}
|
| -
|
| -class RecursiveAstVisitor_DartUnitNavigationComputer_compute extends RecursiveAstVisitor<Object> {
|
| - final DartUnitNavigationComputer DartUnitNavigationComputer_this;
|
| -
|
| - RecursiveAstVisitor_DartUnitNavigationComputer_compute(this.DartUnitNavigationComputer_this) : super();
|
| -
|
| - @override
|
| - Object visitAssignmentExpression(AssignmentExpression node) {
|
| - DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| - return super.visitAssignmentExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitBinaryExpression(BinaryExpression node) {
|
| - DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| - return super.visitBinaryExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitIndexExpression(IndexExpression node) {
|
| - DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.bestElement);
|
| - return super.visitIndexExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitPostfixExpression(PostfixExpression node) {
|
| - DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| - return super.visitPostfixExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitPrefixExpression(PrefixExpression node) {
|
| - DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| - return super.visitPrefixExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitSimpleIdentifier(SimpleIdentifier node) {
|
| - DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement);
|
| - return super.visitSimpleIdentifier(node);
|
| - }
|
| -}
|
| -
|
| -/**
|
| * A computer for [HighlightRegion]s in a Dart [CompilationUnit].
|
| */
|
| class DartUnitHighlightsComputer {
|
| @@ -539,222 +300,82 @@ class DartUnitHighlightsComputer {
|
| }
|
| }
|
|
|
| -class RecursiveAstVisitor_DartUnitHighlightsComputer_compute extends RecursiveAstVisitor<Object> {
|
| - final DartUnitHighlightsComputer DartUnitHighlightsComputer_this;
|
| +/**
|
| + * A computer for [NavigationRegion]s in a Dart [CompilationUnit].
|
| + */
|
| +class DartUnitNavigationComputer {
|
| + final CompilationUnit _unit;
|
|
|
| - RecursiveAstVisitor_DartUnitHighlightsComputer_compute(this.DartUnitHighlightsComputer_this) : super();
|
| + List<NavigationRegion> _regions = [];
|
|
|
| - @override
|
| - Object visitAnnotation(Annotation node) {
|
| - DartUnitHighlightsComputer_this._addIdentifierRegion_annotation(node);
|
| - return super.visitAnnotation(node);
|
| - }
|
| + DartUnitNavigationComputer(this._unit);
|
|
|
| - @override
|
| - Object visitAsExpression(AsExpression node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.asOperator, HighlightType.BUILT_IN);
|
| - return super.visitAsExpression(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitBooleanLiteral(BooleanLiteral node) {
|
| - DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_BOOLEAN);
|
| - return super.visitBooleanLiteral(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitCatchClause(CatchClause node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.onKeyword, HighlightType.BUILT_IN);
|
| - return super.visitCatchClause(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitClassDeclaration(ClassDeclaration node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.abstractKeyword, HighlightType.BUILT_IN);
|
| - return super.visitClassDeclaration(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitConstructorDeclaration(ConstructorDeclaration node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.factoryKeyword, HighlightType.BUILT_IN);
|
| - return super.visitConstructorDeclaration(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitDoubleLiteral(DoubleLiteral node) {
|
| - DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_DOUBLE);
|
| - return super.visitDoubleLiteral(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitExportDirective(ExportDirective node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitExportDirective(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitFieldDeclaration(FieldDeclaration node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.staticKeyword, HighlightType.BUILT_IN);
|
| - return super.visitFieldDeclaration(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitFunctionDeclaration(FunctionDeclaration node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
|
| - return super.visitFunctionDeclaration(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitFunctionTypeAlias(FunctionTypeAlias node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitFunctionTypeAlias(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitHideCombinator(HideCombinator node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitHideCombinator(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitImplementsClause(ImplementsClause node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitImplementsClause(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitImportDirective(ImportDirective node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.deferredToken, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.asToken, HighlightType.BUILT_IN);
|
| - return super.visitImportDirective(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitIntegerLiteral(IntegerLiteral node) {
|
| - DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_INTEGER);
|
| - return super.visitIntegerLiteral(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitLibraryDirective(LibraryDirective node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitLibraryDirective(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitMethodDeclaration(MethodDeclaration node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.modifierKeyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.operatorKeyword, HighlightType.BUILT_IN);
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
|
| - return super.visitMethodDeclaration(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitNativeClause(NativeClause node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitNativeClause(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitNativeFunctionBody(NativeFunctionBody node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.nativeToken, HighlightType.BUILT_IN);
|
| - return super.visitNativeFunctionBody(node);
|
| - }
|
| -
|
| - @override
|
| - Object visitPartDirective(PartDirective node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitPartDirective(node);
|
| + /**
|
| + * Returns the computed [NavigationRegion]s, not `null`.
|
| + */
|
| + List<NavigationRegion> compute() {
|
| + _unit.accept(new RecursiveAstVisitor_DartUnitNavigationComputer_compute(this));
|
| + return new List.from(_regions);
|
| }
|
|
|
| - @override
|
| - Object visitPartOfDirective(PartOfDirective node) {
|
| - DartUnitHighlightsComputer_this._addRegion_tokenStart_tokenEnd(node.partToken, node.ofToken, HighlightType.BUILT_IN);
|
| - return super.visitPartOfDirective(node);
|
| + /**
|
| + * If the given [Element] is not `null`, then creates a corresponding
|
| + * [NavigationRegion].
|
| + */
|
| + void _addRegion(int offset, int length, Element element) {
|
| + NavigationTarget target = _createTarget(element);
|
| + if (target == null) {
|
| + return;
|
| + }
|
| + _regions.add(new NavigationRegionImpl(offset, length, <NavigationTarget> [target]));
|
| }
|
|
|
| - @override
|
| - Object visitShowCombinator(ShowCombinator node) {
|
| - DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| - return super.visitShowCombinator(node);
|
| + void _addRegion_tokenStart_nodeEnd(Token a, AstNode b, Element element) {
|
| + int offset = a.offset;
|
| + int length = b.end - offset;
|
| + _addRegion(offset, length, element);
|
| }
|
|
|
| - @override
|
| - Object visitSimpleIdentifier(SimpleIdentifier node) {
|
| - DartUnitHighlightsComputer_this._addIdentifierRegion(node);
|
| - return super.visitSimpleIdentifier(node);
|
| + /**
|
| + * If the given [Element] is not `null`, then creates a corresponding
|
| + * [NavigationRegion].
|
| + */
|
| + void _addRegionForNode(AstNode node, Element element) {
|
| + int offset = node.offset;
|
| + int length = node.length;
|
| + _addRegion(offset, length, element);
|
| }
|
|
|
| - @override
|
| - Object visitSimpleStringLiteral(SimpleStringLiteral node) {
|
| - DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_STRING);
|
| - return super.visitSimpleStringLiteral(node);
|
| + /**
|
| + * If the given [Element] is not `null`, then creates a corresponding
|
| + * [NavigationRegion].
|
| + */
|
| + void _addRegionForToken(Token token, Element element) {
|
| + int offset = token.offset;
|
| + int length = token.length;
|
| + _addRegion(offset, length, element);
|
| }
|
|
|
| - @override
|
| - Object visitTypeName(TypeName node) {
|
| - DartType type = node.type;
|
| - if (type != null) {
|
| - if (type.isDynamic && node.name.name == "dynamic") {
|
| - DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.TYPE_NAME_DYNAMIC);
|
| - return null;
|
| - }
|
| + /**
|
| + * Returns the [NavigationTarget] for the given [Element], maybe `null` if
|
| + * `null` was given.
|
| + */
|
| + NavigationTarget _createTarget(Element element) {
|
| + if (element == null) {
|
| + return null;
|
| }
|
| - return super.visitTypeName(node);
|
| - }
|
| -}
|
| -
|
| -/**
|
| - * A concrete implementation of [NavigationRegion].
|
| - */
|
| -class NavigationRegionImpl extends SourceRegionImpl implements NavigationRegion {
|
| - final List<NavigationTarget> targets;
|
| -
|
| - NavigationRegionImpl(int offset, int length, this.targets) : super(offset, length);
|
| -
|
| - @override
|
| - String toString() {
|
| - JavaStringBuilder builder = new JavaStringBuilder();
|
| - builder.append(super.toString());
|
| - builder.append(" -> [");
|
| - builder.append(StringUtils.join(targets, ", "));
|
| - builder.append("]");
|
| - return builder.toString();
|
| + if (element is FieldFormalParameterElement) {
|
| + element = (element as FieldFormalParameterElement).field;
|
| + }
|
| + int nameOffset = element.nameOffset;
|
| + int nameLength = element.displayName.length;
|
| + if (nameOffset == -1) {
|
| + nameLength = 0;
|
| + }
|
| + return new NavigationTargetImpl(element.source, _getElementId(element), nameOffset, nameLength);
|
| }
|
| -}
|
| -
|
| -/**
|
| - * A concrete implementation of [NavigationTarget].
|
| - */
|
| -class NavigationTargetImpl implements NavigationTarget {
|
| - final Source source;
|
| -
|
| - final String elementId;
|
| -
|
| - final int offset;
|
| -
|
| - final int length;
|
|
|
| - NavigationTargetImpl(this.source, this.elementId, this.offset, this.length);
|
| -
|
| - @override
|
| - String toString() {
|
| - JavaStringBuilder builder = new JavaStringBuilder();
|
| - builder.append("[offset=");
|
| - builder.append(offset);
|
| - builder.append(", length=");
|
| - builder.append(length);
|
| - builder.append(", source=");
|
| - builder.append(source);
|
| - builder.append(", element=");
|
| - builder.append(elementId);
|
| - builder.append("]");
|
| - return builder.toString();
|
| - }
|
| + String _getElementId(Element element) => element.location.encoding;
|
| }
|
|
|
| /**
|
| @@ -872,14 +493,15 @@ class DartUnitOutlineComputer {
|
| OutlineImpl _newClassOutline(Outline unitOutline, List<Outline> unitChildren, ClassDeclaration classDeclaration) {
|
| SimpleIdentifier nameNode = classDeclaration.name;
|
| String name = nameNode.name;
|
| - OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(classDeclaration), OutlineKind.CLASS, name, nameNode.offset, name.length, null, null, classDeclaration.isAbstract, false);
|
| + OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(classDeclaration), OutlineKind.CLASS, name, nameNode.offset, name.length, null, null, classDeclaration.isAbstract, StringUtilities.startsWithChar(name, 0x5F), false);
|
| unitChildren.add(outline);
|
| return outline;
|
| }
|
|
|
| void _newClassTypeAlias(Outline unitOutline, List<Outline> unitChildren, ClassTypeAlias alias) {
|
| SimpleIdentifier nameNode = alias.name;
|
| - unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), OutlineKind.CLASS_TYPE_ALIAS, nameNode.name, nameNode.offset, nameNode.length, null, null, alias.isAbstract, false));
|
| + String name = nameNode.name;
|
| + unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), OutlineKind.CLASS_TYPE_ALIAS, name, nameNode.offset, nameNode.length, null, null, alias.isAbstract, StringUtilities.startsWithChar(name, 0x5F), false));
|
| }
|
|
|
| void _newConstructorOutline(OutlineImpl classOutline, List<Outline> children, ConstructorDeclaration constructorDeclaration) {
|
| @@ -887,26 +509,31 @@ class DartUnitOutlineComputer {
|
| String name = returnType.name;
|
| int offset = returnType.offset;
|
| int length = returnType.length;
|
| + bool isPrivate = false;
|
| SimpleIdentifier constructorNameNode = constructorDeclaration.name;
|
| if (constructorNameNode != null) {
|
| - name += ".${constructorNameNode.name}";
|
| + String constructorName = constructorNameNode.name;
|
| + isPrivate = StringUtilities.startsWithChar(constructorName, 0x5F);
|
| + name += ".${constructorName}";
|
| offset = constructorNameNode.offset;
|
| length = constructorNameNode.length;
|
| }
|
| FormalParameterList parameters = constructorDeclaration.parameters;
|
| - OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(constructorDeclaration), OutlineKind.CONSTRUCTOR, name, offset, length, parameters != null ? parameters.toSource() : "", null, false, false);
|
| + OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(constructorDeclaration), OutlineKind.CONSTRUCTOR, name, offset, length, parameters != null ? parameters.toSource() : "", null, false, isPrivate, false);
|
| children.add(outline);
|
| _addLocalFunctionOutlines(outline, constructorDeclaration.body);
|
| }
|
|
|
| void _newField(OutlineImpl classOutline, List<Outline> children, String fieldTypeName, VariableDeclaration field, bool isStatic) {
|
| SimpleIdentifier nameNode = field.name;
|
| - children.add(new OutlineImpl(classOutline, _getSourceRegion(field), OutlineKind.FIELD, nameNode.name, nameNode.offset, nameNode.length, null, fieldTypeName, false, isStatic));
|
| + String name = nameNode.name;
|
| + children.add(new OutlineImpl(classOutline, _getSourceRegion(field), OutlineKind.FIELD, name, nameNode.offset, nameNode.length, null, fieldTypeName, false, StringUtilities.startsWithChar(name, 0x5F), isStatic));
|
| }
|
|
|
| void _newFunctionOutline(Outline unitOutline, List<Outline> unitChildren, FunctionDeclaration functionDeclaration) {
|
| TypeName returnType = functionDeclaration.returnType;
|
| SimpleIdentifier nameNode = functionDeclaration.name;
|
| + String name = nameNode.name;
|
| FunctionExpression functionExpression = functionDeclaration.functionExpression;
|
| FormalParameterList parameters = functionExpression.parameters;
|
| OutlineKind kind;
|
| @@ -917,7 +544,7 @@ class DartUnitOutlineComputer {
|
| } else {
|
| kind = OutlineKind.FUNCTION;
|
| }
|
| - OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(functionDeclaration), kind, nameNode.name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, false);
|
| + OutlineImpl outline = new OutlineImpl(unitOutline, _getSourceRegion(functionDeclaration), kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, StringUtilities.startsWithChar(name, 0x5F), false);
|
| unitChildren.add(outline);
|
| _addLocalFunctionOutlines(outline, functionExpression.body);
|
| }
|
| @@ -925,13 +552,15 @@ class DartUnitOutlineComputer {
|
| void _newFunctionTypeAliasOutline(Outline unitOutline, List<Outline> unitChildren, FunctionTypeAlias alias) {
|
| TypeName returnType = alias.returnType;
|
| SimpleIdentifier nameNode = alias.name;
|
| + String name = nameNode.name;
|
| FormalParameterList parameters = alias.parameters;
|
| - unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), OutlineKind.FUNCTION_TYPE_ALIAS, nameNode.name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, false));
|
| + unitChildren.add(new OutlineImpl(unitOutline, _getSourceRegion(alias), OutlineKind.FUNCTION_TYPE_ALIAS, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", false, StringUtilities.startsWithChar(name, 0x5F), false));
|
| }
|
|
|
| void _newMethodOutline(OutlineImpl classOutline, List<Outline> children, MethodDeclaration methodDeclaration) {
|
| TypeName returnType = methodDeclaration.returnType;
|
| SimpleIdentifier nameNode = methodDeclaration.name;
|
| + String name = nameNode.name;
|
| FormalParameterList parameters = methodDeclaration.parameters;
|
| OutlineKind kind;
|
| if (methodDeclaration.isGetter) {
|
| @@ -941,26 +570,447 @@ class DartUnitOutlineComputer {
|
| } else {
|
| kind = OutlineKind.METHOD;
|
| }
|
| - OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(methodDeclaration), kind, nameNode.name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", methodDeclaration.isAbstract, methodDeclaration.isStatic);
|
| + OutlineImpl outline = new OutlineImpl(classOutline, _getSourceRegion(methodDeclaration), kind, name, nameNode.offset, nameNode.length, parameters != null ? parameters.toSource() : "", returnType != null ? returnType.toSource() : "", methodDeclaration.isAbstract, StringUtilities.startsWithChar(name, 0x5F), methodDeclaration.isStatic);
|
| children.add(outline);
|
| _addLocalFunctionOutlines(outline, methodDeclaration.body);
|
| }
|
|
|
| - OutlineImpl _newUnitOutline() => new OutlineImpl(null, new SourceRegionImpl(_unit.offset, _unit.length), OutlineKind.COMPILATION_UNIT, null, 0, 0, null, null, false, false);
|
| + OutlineImpl _newUnitOutline() => new OutlineImpl(null, new SourceRegionImpl(_unit.offset, _unit.length), OutlineKind.COMPILATION_UNIT, null, 0, 0, null, null, false, false, false);
|
| }
|
|
|
| -class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines extends RecursiveAstVisitor<Object> {
|
| - final DartUnitOutlineComputer DartUnitOutlineComputer_this;
|
| -
|
| - OutlineImpl parenet;
|
| -
|
| - List<Outline> localOutlines;
|
| +/**
|
| + * A concrete implementation of [HighlightRegion].
|
| + */
|
| +class HighlightRegionImpl extends SourceRegionImpl implements HighlightRegion {
|
| + final HighlightType type;
|
|
|
| - RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines(this.DartUnitOutlineComputer_this, this.parenet, this.localOutlines) : super();
|
| + HighlightRegionImpl(int offset, int length, this.type) : super(offset, length);
|
|
|
| @override
|
| - Object visitFunctionDeclaration(FunctionDeclaration node) {
|
| - DartUnitOutlineComputer_this._newFunctionOutline(parenet, localOutlines, node);
|
| - return null;
|
| + String toString() {
|
| + JavaStringBuilder builder = new JavaStringBuilder();
|
| + builder.append("[offset=");
|
| + builder.append(offset);
|
| + builder.append(", length=");
|
| + builder.append(length);
|
| + builder.append(", type=");
|
| + builder.append(type);
|
| + builder.append("]");
|
| + return builder.toString();
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * A concrete implementation of [NavigationRegion].
|
| + */
|
| +class NavigationRegionImpl extends SourceRegionImpl implements NavigationRegion {
|
| + final List<NavigationTarget> targets;
|
| +
|
| + NavigationRegionImpl(int offset, int length, this.targets) : super(offset, length);
|
| +
|
| + @override
|
| + String toString() {
|
| + JavaStringBuilder builder = new JavaStringBuilder();
|
| + builder.append(super.toString());
|
| + builder.append(" -> [");
|
| + builder.append(StringUtils.join(targets, ", "));
|
| + builder.append("]");
|
| + return builder.toString();
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * A concrete implementation of [NavigationTarget].
|
| + */
|
| +class NavigationTargetImpl implements NavigationTarget {
|
| + final Source source;
|
| +
|
| + final String elementId;
|
| +
|
| + final int offset;
|
| +
|
| + final int length;
|
| +
|
| + NavigationTargetImpl(this.source, this.elementId, this.offset, this.length);
|
| +
|
| + @override
|
| + String toString() {
|
| + JavaStringBuilder builder = new JavaStringBuilder();
|
| + builder.append("[offset=");
|
| + builder.append(offset);
|
| + builder.append(", length=");
|
| + builder.append(length);
|
| + builder.append(", source=");
|
| + builder.append(source);
|
| + builder.append(", element=");
|
| + builder.append(elementId);
|
| + builder.append("]");
|
| + return builder.toString();
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * A concrete implementation of [Outline].
|
| + */
|
| +class OutlineImpl implements Outline {
|
| + final Outline parent;
|
| +
|
| + final SourceRegion sourceRegion;
|
| +
|
| + final OutlineKind kind;
|
| +
|
| + final String name;
|
| +
|
| + final int offset;
|
| +
|
| + final int length;
|
| +
|
| + final String parameters;
|
| +
|
| + final String returnType;
|
| +
|
| + final bool isAbstract;
|
| +
|
| + final bool isPrivate;
|
| +
|
| + final bool isStatic;
|
| +
|
| + List<Outline> children = Outline.EMPTY_ARRAY;
|
| +
|
| + OutlineImpl(this.parent, this.sourceRegion, this.kind, this.name, this.offset, this.length, this.parameters, this.returnType, this.isAbstract, this.isPrivate, this.isStatic);
|
| +
|
| + @override
|
| + bool operator ==(Object obj) {
|
| + if (identical(obj, this)) {
|
| + return true;
|
| + }
|
| + if (obj is! OutlineImpl) {
|
| + return false;
|
| + }
|
| + OutlineImpl other = obj as OutlineImpl;
|
| + return (other.parent == parent) && other.offset == offset;
|
| + }
|
| +
|
| + @override
|
| + int get hashCode => offset;
|
| +
|
| + @override
|
| + String toString() {
|
| + JavaStringBuilder builder = new JavaStringBuilder();
|
| + builder.append("[name=");
|
| + builder.append(name);
|
| + builder.append(", kind=");
|
| + builder.append(kind);
|
| + builder.append(", offset=");
|
| + builder.append(offset);
|
| + builder.append(", length=");
|
| + builder.append(length);
|
| + builder.append(", parameters=");
|
| + builder.append(parameters);
|
| + builder.append(", return=");
|
| + builder.append(returnType);
|
| + builder.append(", children=[");
|
| + builder.append(StringUtils.join(children, ", "));
|
| + builder.append("]]");
|
| + return builder.toString();
|
| + }
|
| +}
|
| +
|
| +class RecursiveAstVisitor_DartUnitHighlightsComputer_compute extends RecursiveAstVisitor<Object> {
|
| + final DartUnitHighlightsComputer DartUnitHighlightsComputer_this;
|
| +
|
| + RecursiveAstVisitor_DartUnitHighlightsComputer_compute(this.DartUnitHighlightsComputer_this) : super();
|
| +
|
| + @override
|
| + Object visitAnnotation(Annotation node) {
|
| + DartUnitHighlightsComputer_this._addIdentifierRegion_annotation(node);
|
| + return super.visitAnnotation(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitAsExpression(AsExpression node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.asOperator, HighlightType.BUILT_IN);
|
| + return super.visitAsExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitBooleanLiteral(BooleanLiteral node) {
|
| + DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_BOOLEAN);
|
| + return super.visitBooleanLiteral(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitCatchClause(CatchClause node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.onKeyword, HighlightType.BUILT_IN);
|
| + return super.visitCatchClause(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitClassDeclaration(ClassDeclaration node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.abstractKeyword, HighlightType.BUILT_IN);
|
| + return super.visitClassDeclaration(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitConstructorDeclaration(ConstructorDeclaration node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.factoryKeyword, HighlightType.BUILT_IN);
|
| + return super.visitConstructorDeclaration(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitDoubleLiteral(DoubleLiteral node) {
|
| + DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_DOUBLE);
|
| + return super.visitDoubleLiteral(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitExportDirective(ExportDirective node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitExportDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitFieldDeclaration(FieldDeclaration node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.staticKeyword, HighlightType.BUILT_IN);
|
| + return super.visitFieldDeclaration(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitFunctionDeclaration(FunctionDeclaration node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
|
| + return super.visitFunctionDeclaration(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitFunctionTypeAlias(FunctionTypeAlias node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitFunctionTypeAlias(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitHideCombinator(HideCombinator node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitHideCombinator(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitImplementsClause(ImplementsClause node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitImplementsClause(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitImportDirective(ImportDirective node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.deferredToken, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.asToken, HighlightType.BUILT_IN);
|
| + return super.visitImportDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitIntegerLiteral(IntegerLiteral node) {
|
| + DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_INTEGER);
|
| + return super.visitIntegerLiteral(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitLibraryDirective(LibraryDirective node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitLibraryDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitMethodDeclaration(MethodDeclaration node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.externalKeyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.modifierKeyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.operatorKeyword, HighlightType.BUILT_IN);
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.propertyKeyword, HighlightType.BUILT_IN);
|
| + return super.visitMethodDeclaration(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitNativeClause(NativeClause node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitNativeClause(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitNativeFunctionBody(NativeFunctionBody node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.nativeToken, HighlightType.BUILT_IN);
|
| + return super.visitNativeFunctionBody(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPartDirective(PartDirective node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitPartDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPartOfDirective(PartOfDirective node) {
|
| + DartUnitHighlightsComputer_this._addRegion_tokenStart_tokenEnd(node.partToken, node.ofToken, HighlightType.BUILT_IN);
|
| + return super.visitPartOfDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitShowCombinator(ShowCombinator node) {
|
| + DartUnitHighlightsComputer_this._addRegion_token(node.keyword, HighlightType.BUILT_IN);
|
| + return super.visitShowCombinator(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitSimpleIdentifier(SimpleIdentifier node) {
|
| + DartUnitHighlightsComputer_this._addIdentifierRegion(node);
|
| + return super.visitSimpleIdentifier(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitSimpleStringLiteral(SimpleStringLiteral node) {
|
| + DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.LITERAL_STRING);
|
| + return super.visitSimpleStringLiteral(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitTypeName(TypeName node) {
|
| + DartType type = node.type;
|
| + if (type != null) {
|
| + if (type.isDynamic && node.name.name == "dynamic") {
|
| + DartUnitHighlightsComputer_this._addRegion_node(node, HighlightType.TYPE_NAME_DYNAMIC);
|
| + return null;
|
| + }
|
| + }
|
| + return super.visitTypeName(node);
|
| + }
|
| +}
|
| +
|
| +class RecursiveAstVisitor_DartUnitNavigationComputer_compute extends RecursiveAstVisitor<Object> {
|
| + final DartUnitNavigationComputer DartUnitNavigationComputer_this;
|
| +
|
| + RecursiveAstVisitor_DartUnitNavigationComputer_compute(this.DartUnitNavigationComputer_this) : super();
|
| +
|
| + @override
|
| + Object visitAssignmentExpression(AssignmentExpression node) {
|
| + DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| + return super.visitAssignmentExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitBinaryExpression(BinaryExpression node) {
|
| + DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| + return super.visitBinaryExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitExportDirective(ExportDirective node) {
|
| + ExportElement exportElement = node.element;
|
| + if (exportElement != null) {
|
| + Element element = exportElement.exportedLibrary;
|
| + DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element);
|
| + }
|
| + return super.visitExportDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitImportDirective(ImportDirective node) {
|
| + ImportElement importElement = node.element;
|
| + if (importElement != null) {
|
| + Element element = importElement.importedLibrary;
|
| + DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, element);
|
| + }
|
| + return super.visitImportDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitIndexExpression(IndexExpression node) {
|
| + DartUnitNavigationComputer_this._addRegionForToken(node.rightBracket, node.bestElement);
|
| + return super.visitIndexExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPartDirective(PartDirective node) {
|
| + DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.uri, node.element);
|
| + return super.visitPartDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPartOfDirective(PartOfDirective node) {
|
| + DartUnitNavigationComputer_this._addRegion_tokenStart_nodeEnd(node.keyword, node.libraryName, node.element);
|
| + return super.visitPartOfDirective(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPostfixExpression(PostfixExpression node) {
|
| + DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| + return super.visitPostfixExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitPrefixExpression(PrefixExpression node) {
|
| + DartUnitNavigationComputer_this._addRegionForToken(node.operator, node.bestElement);
|
| + return super.visitPrefixExpression(node);
|
| + }
|
| +
|
| + @override
|
| + Object visitSimpleIdentifier(SimpleIdentifier node) {
|
| + DartUnitNavigationComputer_this._addRegionForNode(node, node.bestElement);
|
| + return super.visitSimpleIdentifier(node);
|
| + }
|
| +}
|
| +
|
| +class RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines extends RecursiveAstVisitor<Object> {
|
| + final DartUnitOutlineComputer DartUnitOutlineComputer_this;
|
| +
|
| + OutlineImpl parenet;
|
| +
|
| + List<Outline> localOutlines;
|
| +
|
| + RecursiveAstVisitor_DartUnitOutlineComputer_addLocalFunctionOutlines(this.DartUnitOutlineComputer_this, this.parenet, this.localOutlines) : super();
|
| +
|
| + @override
|
| + Object visitFunctionDeclaration(FunctionDeclaration node) {
|
| + DartUnitOutlineComputer_this._newFunctionOutline(parenet, localOutlines, node);
|
| + return null;
|
| + }
|
| +}
|
| +
|
| +/**
|
| + * A concrete implementation of [SourceRegion].
|
| + */
|
| +class SourceRegionImpl implements SourceRegion {
|
| + final int offset;
|
| +
|
| + final int length;
|
| +
|
| + SourceRegionImpl(this.offset, this.length);
|
| +
|
| + @override
|
| + bool containsInclusive(int x) => offset <= x && x <= offset + length;
|
| +
|
| + @override
|
| + bool operator ==(Object obj) {
|
| + if (identical(obj, this)) {
|
| + return true;
|
| + }
|
| + if (obj is! SourceRegion) {
|
| + return false;
|
| + }
|
| + SourceRegion other = obj as SourceRegion;
|
| + return other.offset == offset && other.length == length;
|
| + }
|
| +
|
| + @override
|
| + int get hashCode => ObjectUtilities.combineHashCodes(offset, length);
|
| +
|
| + @override
|
| + String toString() {
|
| + JavaStringBuilder builder = new JavaStringBuilder();
|
| + builder.append("[offset=");
|
| + builder.append(offset);
|
| + builder.append(", length=");
|
| + builder.append(length);
|
| + builder.append("]");
|
| + return builder.toString();
|
| }
|
| }
|
|
|