| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 category_item; | 5 library category_item; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:dartdoc_viewer/data.dart'; | 10 import 'package:dartdoc_viewer/data.dart'; |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 | 208 |
| 209 /// Adds the comment from [item] to [this]. | 209 /// Adds the comment from [item] to [this]. |
| 210 void addInheritedComment(Item item) {} | 210 void addInheritedComment(Item item) {} |
| 211 | 211 |
| 212 /// Denotes whether this [Item] is inherited from another [Item] or not. | 212 /// Denotes whether this [Item] is inherited from another [Item] or not. |
| 213 @observable bool get isInherited => false; | 213 @observable bool get isInherited => false; |
| 214 | 214 |
| 215 /// Creates a link for the href attribute of an [AnchorElement]. | 215 /// Creates a link for the href attribute of an [AnchorElement]. |
| 216 String get linkHref => qualifiedName; | 216 String get linkHref => qualifiedName; |
| 217 | 217 |
| 218 /// [linkHref] but with the leading # separator. |
| 219 String get prefixedLinkHref => locationPrefixed(linkHref); |
| 220 |
| 218 /// The [DocsLocation] for our URI. | 221 /// The [DocsLocation] for our URI. |
| 219 DocsLocation get location => new DocsLocation(qualifiedName); | 222 DocsLocation get location => new DocsLocation(qualifiedName); |
| 220 | 223 |
| 221 /// The link to an anchor within a larger page, if appropriate. So | 224 /// The link to an anchor within a larger page, if appropriate. So |
| 222 /// e.g. instead of `dart-core.Object.toString`, | 225 /// e.g. instead of `dart-core.Object.toString`, |
| 223 /// `dart-core.Object@id_toString` | 226 /// `dart-core.Object@id_toString` |
| 224 DocsLocation get anchorHrefLocation { | 227 DocsLocation get anchorHrefLocation { |
| 225 var basic = localLocation; | 228 var basic = localLocation; |
| 226 var parent = basic.parentLocation; | 229 var parent = basic.parentLocation; |
| 227 if (parent.isEmpty) return parent; | 230 if (parent.isEmpty) return parent; |
| 228 parent.anchor = parent.toHash(hashDecoratedName); | 231 parent.anchor = parent.toHash(hashDecoratedName); |
| 229 return parent; | 232 return parent; |
| 230 } | 233 } |
| 231 | 234 |
| 232 /// A location based on the actual page we're in, rather than our inherited | 235 /// A location based on the actual page we're in, rather than our inherited |
| 233 /// location. e.g. `dart-async.Future.noSuchMethod` rather than | 236 /// location. e.g. `dart-async.Future.noSuchMethod` rather than |
| 234 /// the original method location of `dart-core.Object.noSuchMethod`. | 237 /// the original method location of `dart-core.Object.noSuchMethod`. |
| 235 /// For non-inherited items, this will just be the [location]. | 238 /// For non-inherited items, this will just be the [location]. |
| 236 DocsLocation get localLocation => location; | 239 DocsLocation get localLocation => location; |
| 237 | 240 |
| 238 String get anchorHref => anchorHrefLocation.withAnchor; | 241 String get anchorHref => anchorHrefLocation.withAnchor; |
| 239 | 242 |
| 243 /// [anchorHref] but with the leading # separator. |
| 244 String get prefixedAnchorHref => locationPrefixed(anchorHref); |
| 245 |
| 240 bool get isLoaded => true; | 246 bool get isLoaded => true; |
| 241 | 247 |
| 242 Item memberNamed(String name, {Function orElse : nothing}) => nothing(); | 248 Item memberNamed(String name, {Function orElse : nothing}) => nothing(); |
| 243 | 249 |
| 244 Item get owner => _owner == null ? | 250 Item get owner => _owner == null ? |
| 245 _owner = pageIndex[location.parentQualifiedName] : _owner; | 251 _owner = pageIndex[location.parentQualifiedName] : _owner; |
| 246 | 252 |
| 247 /// Return true if [possibleOwner] is anywhere in our chain of owners. | 253 /// Return true if [possibleOwner] is anywhere in our chain of owners. |
| 248 bool isOwnedBy(Item possibleOwner) { | 254 bool isOwnedBy(Item possibleOwner) { |
| 249 if (owner == null || possibleOwner == null) return false; | 255 if (owner == null || possibleOwner == null) return false; |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 } | 1048 } |
| 1043 | 1049 |
| 1044 | 1050 |
| 1045 bool _boolFor(String key, Map input) { | 1051 bool _boolFor(String key, Map input) { |
| 1046 var value = input[key]; | 1052 var value = input[key]; |
| 1047 if (value == true || value == 'true') return true; | 1053 if (value == true || value == 'true') return true; |
| 1048 if (value == null || value == false || value == 'false') return false; | 1054 if (value == null || value == false || value == 'false') return false; |
| 1049 throw new FormatException("Invalid format, expected boolean key: $key" | 1055 throw new FormatException("Invalid format, expected boolean key: $key" |
| 1050 " value: $value"); | 1056 " value: $value"); |
| 1051 } | 1057 } |
| OLD | NEW |