| 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; |
| 8 import 'package:analyzer/dart/ast/token.dart' show Token; |
| 9 import 'package:analyzer/src/generated/element.dart' show ElementImpl; |
| 7 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| 8 | 11 |
| 9 /** | 12 /** |
| 13 * If the given [node] has a documentation comment, remember its content |
| 14 * and range into the given [element]. |
| 15 */ |
| 16 void setElementDocumentationComment(ElementImpl element, AnnotatedNode node) { |
| 17 Comment comment = node.documentationComment; |
| 18 if (comment != null && comment.isDocumentation) { |
| 19 element.documentationComment = |
| 20 comment.tokens.map((Token t) => t.lexeme).join('\n'); |
| 21 element.setDocRange(comment.offset, comment.length); |
| 22 } |
| 23 } |
| 24 |
| 25 /** |
| 10 * Check whether [uri1] starts with (or 'is prefixed by') [uri2] by checking | 26 * Check whether [uri1] starts with (or 'is prefixed by') [uri2] by checking |
| 11 * path segments. | 27 * path segments. |
| 12 */ | 28 */ |
| 13 bool startsWith(Uri uri1, Uri uri2) { | 29 bool startsWith(Uri uri1, Uri uri2) { |
| 14 List<String> uri1Segments = uri1.pathSegments; | 30 List<String> uri1Segments = uri1.pathSegments; |
| 15 List<String> uri2Segments = uri2.pathSegments.toList(); | 31 List<String> uri2Segments = uri2.pathSegments.toList(); |
| 16 // Punt if empty (https://github.com/dart-lang/sdk/issues/24126) | 32 // Punt if empty (https://github.com/dart-lang/sdk/issues/24126) |
| 17 if (uri2Segments.isEmpty) { | 33 if (uri2Segments.isEmpty) { |
| 18 return false; | 34 return false; |
| 19 } | 35 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 final bool isOptional; | 72 final bool isOptional; |
| 57 | 73 |
| 58 /** | 74 /** |
| 59 * Initialize a newly created kind with the given state. | 75 * Initialize a newly created kind with the given state. |
| 60 * | 76 * |
| 61 * @param isOptional `true` if this is an optional parameter | 77 * @param isOptional `true` if this is an optional parameter |
| 62 */ | 78 */ |
| 63 const ParameterKind(String name, int ordinal, this.isOptional) | 79 const ParameterKind(String name, int ordinal, this.isOptional) |
| 64 : super(name, ordinal); | 80 : super(name, ordinal); |
| 65 } | 81 } |
| OLD | NEW |