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

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2669863003: Handle invalid URIs in summaries. (Closed)
Patch Set: Remove uri.dart, tweak for summarize_ast_test. 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) 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.task.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/standard_resolution_map.dart'; 10 import 'package:analyzer/dart/ast/standard_resolution_map.dart';
(...skipping 4240 matching lines...) Expand 10 before | Expand all | Expand 10 after
4251 4251
4252 /** 4252 /**
4253 * Return the result of resolve the given [uriContent], reporting errors 4253 * Return the result of resolve the given [uriContent], reporting errors
4254 * against the [uriLiteral]. 4254 * against the [uriLiteral].
4255 */ 4255 */
4256 Source _resolveUri( 4256 Source _resolveUri(
4257 bool isImport, StringLiteral uriLiteral, String uriContent) { 4257 bool isImport, StringLiteral uriLiteral, String uriContent) {
4258 UriValidationCode code = 4258 UriValidationCode code =
4259 UriBasedDirectiveImpl.validateUri(isImport, uriLiteral, uriContent); 4259 UriBasedDirectiveImpl.validateUri(isImport, uriLiteral, uriContent);
4260 if (code == null) { 4260 if (code == null) {
4261 String encodedUriContent = Uri.encodeFull(uriContent); 4261 try {
4262 return context.sourceFactory.resolveUri(_source, encodedUriContent); 4262 Uri.parse(uriContent);
4263 } on FormatException {
4264 return null;
4265 }
4266 return context.sourceFactory.resolveUri(_source, uriContent);
4263 } else if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) { 4267 } else if (code == UriValidationCode.URI_WITH_DART_EXT_SCHEME) {
4264 return null; 4268 return null;
4265 } else if (code == UriValidationCode.URI_WITH_INTERPOLATION) { 4269 } else if (code == UriValidationCode.URI_WITH_INTERPOLATION) {
4266 _errorReporter.reportErrorForNode( 4270 _errorReporter.reportErrorForNode(
4267 CompileTimeErrorCode.URI_WITH_INTERPOLATION, uriLiteral); 4271 CompileTimeErrorCode.URI_WITH_INTERPOLATION, uriLiteral);
4268 return null; 4272 return null;
4269 } else if (code == UriValidationCode.INVALID_URI) { 4273 } else if (code == UriValidationCode.INVALID_URI) {
4270 _errorReporter.reportErrorForNode( 4274 _errorReporter.reportErrorForNode(
4271 CompileTimeErrorCode.INVALID_URI, uriLiteral, [uriContent]); 4275 CompileTimeErrorCode.INVALID_URI, uriLiteral, [uriContent]);
4272 return null; 4276 return null;
(...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after
6551 6555
6552 @override 6556 @override
6553 bool moveNext() { 6557 bool moveNext() {
6554 if (_newSources.isEmpty) { 6558 if (_newSources.isEmpty) {
6555 return false; 6559 return false;
6556 } 6560 }
6557 currentTarget = _newSources.removeLast(); 6561 currentTarget = _newSources.removeLast();
6558 return true; 6562 return true;
6559 } 6563 }
6560 } 6564 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/link.dart ('k') | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698