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

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

Issue 2665213003: Encode URIs stored in unlinked summaries to make them Uri.parse() safe. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/format.dart'; 8 import 'package:analyzer/src/summary/format.dart';
9 import 'package:analyzer/src/summary/idl.dart'; 9 import 'package:analyzer/src/summary/idl.dart';
10 10
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 name: name, 140 name: name,
141 kind: ReferenceKind.propertyAccessor, 141 kind: ReferenceKind.propertyAccessor,
142 numTypeParameters: 0)); 142 numTypeParameters: 0));
143 } 143 }
144 } 144 }
145 } 145 }
146 } 146 }
147 147
148 @override 148 @override
149 visitExportDirective(ExportDirective node) { 149 visitExportDirective(ExportDirective node) {
150 String uriStr = Uri.encodeFull(node.uri.stringValue ?? '');
Brian Wilkerson 2017/02/01 17:28:24 Consider a getter (such as 'encodedUri') on UriBas
150 exports.add(new UnlinkedExportPublicBuilder( 151 exports.add(new UnlinkedExportPublicBuilder(
151 uri: node.uri.stringValue, 152 uri: uriStr,
152 combinators: node.combinators 153 combinators: node.combinators
153 .map((Combinator c) => c.accept(new _CombinatorEncoder())) 154 .map((Combinator c) => c.accept(new _CombinatorEncoder()))
154 .toList(), 155 .toList(),
155 configurations: 156 configurations:
156 node.configurations.map(serializeConfiguration).toList())); 157 node.configurations.map(serializeConfiguration).toList()));
157 } 158 }
158 159
159 @override 160 @override
160 visitFunctionDeclaration(FunctionDeclaration node) { 161 visitFunctionDeclaration(FunctionDeclaration node) {
161 String name = node.name.name; 162 String name = node.name.name;
162 if (node.isSetter) { 163 if (node.isSetter) {
163 name += '='; 164 name += '=';
164 } 165 }
165 addNameIfPublic( 166 addNameIfPublic(
166 name, 167 name,
167 node.isGetter || node.isSetter 168 node.isGetter || node.isSetter
168 ? ReferenceKind.topLevelPropertyAccessor 169 ? ReferenceKind.topLevelPropertyAccessor
169 : ReferenceKind.topLevelFunction, 170 : ReferenceKind.topLevelFunction,
170 node.functionExpression.typeParameters?.typeParameters?.length ?? 0); 171 node.functionExpression.typeParameters?.typeParameters?.length ?? 0);
171 } 172 }
172 173
173 @override 174 @override
174 visitFunctionTypeAlias(FunctionTypeAlias node) { 175 visitFunctionTypeAlias(FunctionTypeAlias node) {
175 addNameIfPublic(node.name.name, ReferenceKind.typedef, 176 addNameIfPublic(node.name.name, ReferenceKind.typedef,
176 node.typeParameters?.typeParameters?.length ?? 0); 177 node.typeParameters?.typeParameters?.length ?? 0);
177 } 178 }
178 179
179 @override 180 @override
180 visitPartDirective(PartDirective node) { 181 visitPartDirective(PartDirective node) {
181 parts.add(node.uri.stringValue ?? ''); 182 String uriStr = Uri.encodeFull(node.uri.stringValue ?? '');
183 parts.add(uriStr);
182 } 184 }
183 185
184 @override 186 @override
185 visitVariableDeclaration(VariableDeclaration node) { 187 visitVariableDeclaration(VariableDeclaration node) {
186 String name = node.name.name; 188 String name = node.name.name;
187 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0); 189 addNameIfPublic(name, ReferenceKind.topLevelPropertyAccessor, 0);
188 if (!node.isFinal && !node.isConst) { 190 if (!node.isFinal && !node.isConst) {
189 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0); 191 addNameIfPublic('$name=', ReferenceKind.topLevelPropertyAccessor, 0);
190 } 192 }
191 } 193 }
192 } 194 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698