| 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/src/dart/element/element.dart' show ElementImpl; | 9 import 'package:analyzer/src/dart/element/element.dart' show ElementImpl; |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| 11 import 'package:analyzer/src/generated/java_engine.dart'; | 11 import 'package:analyzer/src/generated/java_engine.dart'; |
| 12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * Resolve the [containedUri] against [baseUri] using Dart rules. | 15 * Resolve the [containedUri] against [baseUri] using Dart rules. |
| 16 * | 16 * |
| 17 * This function behaves similarly to [Uri.resolveUri], except that it properly | 17 * This function behaves similarly to [Uri.resolveUri], except that it properly |
| 18 * handles situations like the following: | 18 * handles situations like the following: |
| 19 * | 19 * |
| 20 * resolveRelativeUri(dart:core, bool.dart) -> dart:core/bool.dart | 20 * resolveRelativeUri(dart:core, bool.dart) -> dart:core/bool.dart |
| 21 * resolveRelativeUri(package:a/b.dart, ../c.dart) -> package:a/c.dart | 21 * resolveRelativeUri(package:a/b.dart, ../c.dart) -> package:a/c.dart |
| 22 */ | 22 */ |
| 23 Uri resolveRelativeUri(Uri baseUri, Uri containedUri) { | 23 Uri resolveRelativeUri(Uri baseUri, Uri containedUri) { |
| 24 if (containedUri.isAbsolute) { |
| 25 return containedUri; |
| 26 } |
| 24 Uri origBaseUri = baseUri; | 27 Uri origBaseUri = baseUri; |
| 25 try { | 28 try { |
| 26 bool isOpaque = baseUri.isAbsolute && !baseUri.path.startsWith('/'); | 29 bool isOpaque = baseUri.isAbsolute && !baseUri.path.startsWith('/'); |
| 27 if (isOpaque) { | 30 if (isOpaque) { |
| 28 String scheme = baseUri.scheme; | 31 String scheme = baseUri.scheme; |
| 29 String part = baseUri.path; | 32 String part = baseUri.path; |
| 30 if (scheme == DartUriResolver.DART_SCHEME && part.indexOf('/') < 0) { | 33 if (scheme == DartUriResolver.DART_SCHEME && part.indexOf('/') < 0) { |
| 31 part = "$part/$part.dart"; | 34 part = "$part/$part.dart"; |
| 32 } | 35 } |
| 33 baseUri = parseUriWithException("$scheme:/$part"); | 36 baseUri = parseUriWithException("$scheme:/$part"); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 final bool isOptional; | 111 final bool isOptional; |
| 109 | 112 |
| 110 /** | 113 /** |
| 111 * Initialize a newly created kind with the given state. | 114 * Initialize a newly created kind with the given state. |
| 112 * | 115 * |
| 113 * @param isOptional `true` if this is an optional parameter | 116 * @param isOptional `true` if this is an optional parameter |
| 114 */ | 117 */ |
| 115 const ParameterKind(String name, int ordinal, this.isOptional) | 118 const ParameterKind(String name, int ordinal, this.isOptional) |
| 116 : super(name, ordinal); | 119 : super(name, ordinal); |
| 117 } | 120 } |
| OLD | NEW |