@@ -3839,6 +3839,8 @@ ManglingErrorOr<NodePointer> Demangle::getUnspecialized(Node *node,
3839
3839
case Node::Kind::TypeAlias:
3840
3840
case Node::Kind::OtherNominalType: {
3841
3841
NodePointer result = Factory.createNode (node->getKind ());
3842
+
3843
+ DEMANGLER_ASSERT (node->hasChildren (), node);
3842
3844
NodePointer parentOrModule = node->getChild (0 );
3843
3845
if (isSpecialized (parentOrModule)) {
3844
3846
auto unspec = getUnspecialized (parentOrModule, Factory);
@@ -3859,21 +3861,25 @@ ManglingErrorOr<NodePointer> Demangle::getUnspecialized(Node *node,
3859
3861
case Node::Kind::BoundGenericProtocol:
3860
3862
case Node::Kind::BoundGenericOtherNominalType:
3861
3863
case Node::Kind::BoundGenericTypeAlias: {
3864
+ DEMANGLER_ASSERT (node->hasChildren (), node);
3862
3865
NodePointer unboundType = node->getChild (0 );
3863
3866
DEMANGLER_ASSERT (unboundType->getKind () == Node::Kind::Type, unboundType);
3867
+ DEMANGLER_ASSERT (unboundType->hasChildren (), unboundType);
3864
3868
NodePointer nominalType = unboundType->getChild (0 );
3865
3869
if (isSpecialized (nominalType))
3866
3870
return getUnspecialized (nominalType, Factory);
3867
3871
return nominalType;
3868
3872
}
3869
3873
3870
3874
case Node::Kind::ConstrainedExistential: {
3875
+ DEMANGLER_ASSERT (node->hasChildren (), node);
3871
3876
NodePointer unboundType = node->getChild (0 );
3872
3877
DEMANGLER_ASSERT (unboundType->getKind () == Node::Kind::Type, unboundType);
3873
3878
return unboundType;
3874
3879
}
3875
3880
3876
3881
case Node::Kind::BoundGenericFunction: {
3882
+ DEMANGLER_ASSERT (node->hasChildren (), node);
3877
3883
NodePointer unboundFunction = node->getChild (0 );
3878
3884
DEMANGLER_ASSERT (unboundFunction->getKind () == Node::Kind::Function ||
3879
3885
unboundFunction->getKind () ==
@@ -3885,6 +3891,7 @@ ManglingErrorOr<NodePointer> Demangle::getUnspecialized(Node *node,
3885
3891
}
3886
3892
3887
3893
case Node::Kind::Extension: {
3894
+ DEMANGLER_ASSERT (node->getNumChildren () >= 2 , node);
3888
3895
NodePointer parent = node->getChild (1 );
3889
3896
if (!isSpecialized (parent))
3890
3897
return node;
0 commit comments