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

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

Issue 2321263003: Remove parseUriWithException() and URISyntaxException. (Closed)
Patch Set: Created 4 years, 3 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.dart.ast.ast; 5 library analyzer.src.dart.ast.ast;
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/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 10508 matching lines...) Expand 10 before | Expand all | Expand 10 after
10519 @override 10519 @override
10520 StringLiteral get uri => _uri; 10520 StringLiteral get uri => _uri;
10521 10521
10522 @override 10522 @override
10523 void set uri(StringLiteral uri) { 10523 void set uri(StringLiteral uri) {
10524 _uri = _becomeParentOf(uri as AstNodeImpl); 10524 _uri = _becomeParentOf(uri as AstNodeImpl);
10525 } 10525 }
10526 10526
10527 @override 10527 @override
10528 UriValidationCode validate() { 10528 UriValidationCode validate() {
10529 StringLiteral uriLiteral = uri; 10529 StringLiteral uriLiteral = this.uri;
10530 if (uriLiteral is StringInterpolation) { 10530 if (uriLiteral is StringInterpolation) {
10531 return UriValidationCode.URI_WITH_INTERPOLATION; 10531 return UriValidationCode.URI_WITH_INTERPOLATION;
10532 } 10532 }
10533 String uriContent = this.uriContent; 10533 String uriContent = this.uriContent;
10534 if (uriContent == null) { 10534 if (uriContent == null) {
10535 return UriValidationCode.INVALID_URI; 10535 return UriValidationCode.INVALID_URI;
10536 } 10536 }
10537 if (this is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME)) { 10537 if (this is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME)) {
10538 return UriValidationCode.URI_WITH_DART_EXT_SCHEME; 10538 return UriValidationCode.URI_WITH_DART_EXT_SCHEME;
10539 } 10539 }
10540 Uri uri;
10540 try { 10541 try {
10541 parseUriWithException(Uri.encodeFull(uriContent)); 10542 uri = Uri.parse(Uri.encodeFull(uriContent));
10542 } on URISyntaxException { 10543 } on FormatException {
10544 return UriValidationCode.INVALID_URI;
10545 }
10546 if (uri.path.isEmpty) {
10543 return UriValidationCode.INVALID_URI; 10547 return UriValidationCode.INVALID_URI;
10544 } 10548 }
10545 return null; 10549 return null;
10546 } 10550 }
10547 10551
10548 @override 10552 @override
10549 void visitChildren(AstVisitor visitor) { 10553 void visitChildren(AstVisitor visitor) {
10550 super.visitChildren(visitor); 10554 super.visitChildren(visitor);
10551 _uri?.accept(visitor); 10555 _uri?.accept(visitor);
10552 } 10556 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
11043 11047
11044 @override 11048 @override
11045 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 11049 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
11046 visitor.visitYieldStatement(this); 11050 visitor.visitYieldStatement(this);
11047 11051
11048 @override 11052 @override
11049 void visitChildren(AstVisitor visitor) { 11053 void visitChildren(AstVisitor visitor) {
11050 _expression?.accept(visitor); 11054 _expression?.accept(visitor);
11051 } 11055 }
11052 } 11056 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698