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

Side by Side Diff: pkg/analyzer/lib/src/summary/summarize_ast.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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 serialization.summarize_ast; 5 library serialization.summarize_ast;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/ast/token.dart'; 8 import 'package:analyzer/dart/ast/token.dart';
9 import 'package:analyzer/dart/ast/visitor.dart'; 9 import 'package:analyzer/dart/ast/visitor.dart';
10 import 'package:analyzer/dart/element/type.dart' show DartType; 10 import 'package:analyzer/dart/element/type.dart' show DartType;
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 hasCoreBeenImported = true; 1299 hasCoreBeenImported = true;
1300 } 1300 }
1301 b.offset = node.offset; 1301 b.offset = node.offset;
1302 b.combinators = node.combinators.map(serializeCombinator).toList(); 1302 b.combinators = node.combinators.map(serializeCombinator).toList();
1303 b.configurations = node.configurations.map(serializeConfiguration).toList(); 1303 b.configurations = node.configurations.map(serializeConfiguration).toList();
1304 if (node.prefix != null) { 1304 if (node.prefix != null) {
1305 b.prefixReference = serializeReference(null, node.prefix.name); 1305 b.prefixReference = serializeReference(null, node.prefix.name);
1306 b.prefixOffset = node.prefix.offset; 1306 b.prefixOffset = node.prefix.offset;
1307 } 1307 }
1308 b.isDeferred = node.deferredKeyword != null; 1308 b.isDeferred = node.deferredKeyword != null;
1309 b.uri = node.uri.stringValue; 1309 b.uri = Uri.encodeFull(node.uri.stringValue ?? '');
1310 b.uriOffset = node.uri.offset; 1310 b.uriOffset = node.uri.offset;
1311 b.uriEnd = node.uri.end; 1311 b.uriEnd = node.uri.end;
1312 unlinkedImports.add(b); 1312 unlinkedImports.add(b);
1313 } 1313 }
1314 1314
1315 @override 1315 @override
1316 void visitLabel(Label node) { 1316 void visitLabel(Label node) {
1317 AstNode parent = node.parent; 1317 AstNode parent = node.parent;
1318 if (parent is! NamedExpression) { 1318 if (parent is! NamedExpression) {
1319 labels.add(new UnlinkedLabelBuilder( 1319 labels.add(new UnlinkedLabelBuilder(
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 /** 1417 /**
1418 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s. 1418 * A [_TypeParameterScope] is a [_Scope] which defines [_ScopedTypeParameter]s.
1419 */ 1419 */
1420 class _TypeParameterScope extends _Scope { 1420 class _TypeParameterScope extends _Scope {
1421 /** 1421 /**
1422 * Get the number of [_ScopedTypeParameter]s defined in this 1422 * Get the number of [_ScopedTypeParameter]s defined in this
1423 * [_TypeParameterScope]. 1423 * [_TypeParameterScope].
1424 */ 1424 */
1425 int get length => _definedNames.length; 1425 int get length => _definedNames.length;
1426 } 1426 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698