Skip to content

Commit 67f72d5

Browse files
authored
Tidy up Parameter.htmlId (#3723)
1 parent d599364 commit 67f72d5

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

lib/src/model/parameter.dart

+14-15
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,22 @@ class Parameter extends ModelElement with HasNoPage {
3838
@override
3939
String get htmlId {
4040
final enclosingElement = element.enclosingElement;
41-
if (enclosingElement != null) {
42-
var enclosingName = enclosingElement.name;
43-
if (enclosingElement is GenericFunctionTypeElement) {
44-
// TODO(jcollins-g): Drop when GenericFunctionTypeElement populates
45-
// name. Also, allowing null here is allowed as a workaround for
46-
// dart-lang/sdk#32005.
47-
for (Element e = enclosingElement;
48-
e.enclosingElement != null;
49-
e = e.enclosingElement!) {
50-
enclosingName = e.name;
51-
if (enclosingName != null && enclosingName.isNotEmpty) break;
52-
}
53-
}
54-
return '$enclosingName-param-$name';
55-
} else {
41+
if (enclosingElement == null) {
5642
return 'param-$name';
5743
}
44+
var enclosingName = enclosingElement.name;
45+
if (enclosingElement is GenericFunctionTypeElement) {
46+
// TODO(jcollins-g): Drop when GenericFunctionTypeElement populates
47+
// name. Also, allowing null here is allowed as a workaround for
48+
// dart-lang/sdk#32005.
49+
for (Element e = enclosingElement;
50+
e.enclosingElement != null;
51+
e = e.enclosingElement!) {
52+
enclosingName = e.name;
53+
if (enclosingName != null && enclosingName.isNotEmpty) break;
54+
}
55+
}
56+
return '$enclosingName-param-$name';
5857
}
5958

6059
@override

0 commit comments

Comments
 (0)