| OLD | NEW |
| 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.generated.utilities_dart; | 5 library analyzer.src.generated.utilities_dart; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart' show AnnotatedNode, Comment; | 7 import 'package:analyzer/dart/ast/ast.dart' show AnnotatedNode, Comment; |
| 8 import 'package:analyzer/dart/ast/token.dart' show Token; | 8 import 'package:analyzer/dart/ast/token.dart' show Token; |
| 9 import 'package:analyzer/exception/exception.dart'; | 9 import 'package:analyzer/exception/exception.dart'; |
| 10 import 'package:analyzer/src/dart/element/element.dart' show ElementImpl; | 10 import 'package:analyzer/src/dart/element/element.dart' show ElementImpl; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 Uri origBaseUri = baseUri; | 26 Uri origBaseUri = baseUri; |
| 27 try { | 27 try { |
| 28 String scheme = baseUri.scheme; | 28 String scheme = baseUri.scheme; |
| 29 // dart:core => dart:core/core.dart | 29 // dart:core => dart:core/core.dart |
| 30 if (scheme == DartUriResolver.DART_SCHEME) { | 30 if (scheme == DartUriResolver.DART_SCHEME) { |
| 31 String part = baseUri.path; | 31 String part = baseUri.path; |
| 32 if (part.indexOf('/') < 0) { | 32 if (part.indexOf('/') < 0) { |
| 33 baseUri = Uri.parse('$scheme:$part/$part.dart'); | 33 baseUri = Uri.parse('$scheme:$part/$part.dart'); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 // foo.dart + ../bar.dart = ../bar.dart | |
| 37 // TODO(scheglov) Remove this temporary workaround. | |
| 38 // Should be fixed as https://github.com/dart-lang/sdk/issues/27447 | |
| 39 List<String> baseSegments = baseUri.pathSegments; | |
| 40 List<String> containedSegments = containedUri.pathSegments; | |
| 41 if (baseSegments.length == 1 && | |
| 42 containedSegments.length > 0 && | |
| 43 containedSegments[0] == '..') { | |
| 44 return containedUri; | |
| 45 } | |
| 46 return baseUri.resolveUri(containedUri); | 36 return baseUri.resolveUri(containedUri); |
| 47 } catch (exception, stackTrace) { | 37 } catch (exception, stackTrace) { |
| 48 throw new AnalysisException( | 38 throw new AnalysisException( |
| 49 "Could not resolve URI ($containedUri) relative to source ($origBaseUri)
", | 39 "Could not resolve URI ($containedUri) relative to source ($origBaseUri)
", |
| 50 new CaughtException(exception, stackTrace)); | 40 new CaughtException(exception, stackTrace)); |
| 51 } | 41 } |
| 52 } | 42 } |
| 53 | 43 |
| 54 /** | 44 /** |
| 55 * If the given [node] has a documentation comment, remember its content | 45 * If the given [node] has a documentation comment, remember its content |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 119 |
| 130 @override | 120 @override |
| 131 int get hashCode => ordinal; | 121 int get hashCode => ordinal; |
| 132 | 122 |
| 133 @override | 123 @override |
| 134 int compareTo(ParameterKind other) => ordinal - other.ordinal; | 124 int compareTo(ParameterKind other) => ordinal - other.ordinal; |
| 135 | 125 |
| 136 @override | 126 @override |
| 137 String toString() => name; | 127 String toString() => name; |
| 138 } | 128 } |
| OLD | NEW |