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

Side by Side Diff: pkg/analyzer/lib/src/summary/public_namespace_computer.dart

Issue 1565283002: Add uriOffset and uriEnd to the summary. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer.src.summary.public_namespace_visitor; 5 library analyzer.src.summary.public_namespace_visitor;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/src/summary/base.dart'; 8 import 'package:analyzer/src/summary/base.dart';
9 import 'package:analyzer/src/summary/format.dart'; 9 import 'package:analyzer/src/summary/format.dart';
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 @override 36 @override
37 UnlinkedCombinatorBuilder visitShowCombinator(ShowCombinator node) { 37 UnlinkedCombinatorBuilder visitShowCombinator(ShowCombinator node) {
38 return encodeUnlinkedCombinator(ctx, shows: encodeNames(node.shownNames)); 38 return encodeUnlinkedCombinator(ctx, shows: encodeNames(node.shownNames));
39 } 39 }
40 } 40 }
41 41
42 class _PublicNamespaceVisitor extends RecursiveAstVisitor { 42 class _PublicNamespaceVisitor extends RecursiveAstVisitor {
43 final BuilderContext ctx; 43 final BuilderContext ctx;
44 final List<UnlinkedPublicNameBuilder> names = <UnlinkedPublicNameBuilder>[]; 44 final List<UnlinkedPublicNameBuilder> names = <UnlinkedPublicNameBuilder>[];
45 final List<UnlinkedExportBuilder> exports = <UnlinkedExportBuilder>[]; 45 final List<UnlinkedExportPublicBuilder> exports =
46 final List<UnlinkedPartBuilder> parts = <UnlinkedPartBuilder>[]; 46 <UnlinkedExportPublicBuilder>[];
47 final List<String> parts = <String>[];
47 48
48 _PublicNamespaceVisitor(this.ctx); 49 _PublicNamespaceVisitor(this.ctx);
49 50
50 void addNameIfPublic( 51 void addNameIfPublic(
51 String name, PrelinkedReferenceKind kind, int numTypeParameters) { 52 String name, PrelinkedReferenceKind kind, int numTypeParameters) {
52 if (isPublic(name)) { 53 if (isPublic(name)) {
53 names.add(encodeUnlinkedPublicName(ctx, 54 names.add(encodeUnlinkedPublicName(ctx,
54 name: name, kind: kind, numTypeParameters: numTypeParameters)); 55 name: name, kind: kind, numTypeParameters: numTypeParameters));
55 } 56 }
56 } 57 }
(...skipping 12 matching lines...) Expand all
69 node.typeParameters?.typeParameters?.length ?? 0); 70 node.typeParameters?.typeParameters?.length ?? 0);
70 } 71 }
71 72
72 @override 73 @override
73 visitEnumDeclaration(EnumDeclaration node) { 74 visitEnumDeclaration(EnumDeclaration node) {
74 addNameIfPublic(node.name.name, PrelinkedReferenceKind.classOrEnum, 0); 75 addNameIfPublic(node.name.name, PrelinkedReferenceKind.classOrEnum, 0);
75 } 76 }
76 77
77 @override 78 @override
78 visitExportDirective(ExportDirective node) { 79 visitExportDirective(ExportDirective node) {
79 exports.add(encodeUnlinkedExport(ctx, 80 exports.add(encodeUnlinkedExportPublic(ctx,
80 uri: node.uri.stringValue, 81 uri: node.uri.stringValue,
81 combinators: node.combinators 82 combinators: node.combinators
82 .map((Combinator c) => c.accept(new _CombinatorEncoder(ctx))) 83 .map((Combinator c) => c.accept(new _CombinatorEncoder(ctx)))
83 .toList())); 84 .toList()));
84 } 85 }
85 86
86 @override 87 @override
87 visitFunctionDeclaration(FunctionDeclaration node) { 88 visitFunctionDeclaration(FunctionDeclaration node) {
88 String name = node.name.name; 89 String name = node.name.name;
89 if (node.isSetter) { 90 if (node.isSetter) {
90 name += '='; 91 name += '=';
91 } 92 }
92 addNameIfPublic(name, PrelinkedReferenceKind.other, 93 addNameIfPublic(name, PrelinkedReferenceKind.other,
93 node.functionExpression.typeParameters?.typeParameters?.length ?? 0); 94 node.functionExpression.typeParameters?.typeParameters?.length ?? 0);
94 } 95 }
95 96
96 @override 97 @override
97 visitFunctionTypeAlias(FunctionTypeAlias node) { 98 visitFunctionTypeAlias(FunctionTypeAlias node) {
98 addNameIfPublic(node.name.name, PrelinkedReferenceKind.typedef, 99 addNameIfPublic(node.name.name, PrelinkedReferenceKind.typedef,
99 node.typeParameters?.typeParameters?.length ?? 0); 100 node.typeParameters?.typeParameters?.length ?? 0);
100 } 101 }
101 102
102 @override 103 @override
103 visitPartDirective(PartDirective node) { 104 visitPartDirective(PartDirective node) {
104 parts.add(encodeUnlinkedPart(ctx, uri: node.uri.stringValue)); 105 parts.add(node.uri.stringValue);
105 } 106 }
106 107
107 @override 108 @override
108 visitVariableDeclaration(VariableDeclaration node) { 109 visitVariableDeclaration(VariableDeclaration node) {
109 String name = node.name.name; 110 String name = node.name.name;
110 addNameIfPublic(name, PrelinkedReferenceKind.other, 0); 111 addNameIfPublic(name, PrelinkedReferenceKind.other, 0);
111 if (!node.isFinal && !node.isConst) { 112 if (!node.isFinal && !node.isConst) {
112 addNameIfPublic('$name=', PrelinkedReferenceKind.other, 0); 113 addNameIfPublic('$name=', PrelinkedReferenceKind.other, 0);
113 } 114 }
114 } 115 }
115 } 116 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/format.dart ('k') | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698