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