@@ -760,9 +760,12 @@ Desugar(swift::Demangle::Demangler &dem, swift::Demangle::NodePointer node,
760
760
type->addChild (concrete, dem);
761
761
}
762
762
NodePointer type_list = dem.createNode (Node::Kind::TypeList);
763
- {
763
+
764
+ assert (node->getNumChildren () >= 1 && node->getNumChildren () <= 2 &&
765
+ " Sugared types should only have 1 or 2 children" );
766
+ for (NodePointer child : *node) {
764
767
NodePointer type = dem.createNode (Node::Kind::Type);
765
- type->addChild (node-> getFirstChild () , dem);
768
+ type->addChild (child , dem);
766
769
type_list->addChild (type, dem);
767
770
}
768
771
desugared->addChild (type, dem);
@@ -969,7 +972,7 @@ swift::Demangle::NodePointer TypeSystemSwiftTypeRef::GetNodeForPrintingImpl(
969
972
}
970
973
return node;
971
974
case Node::Kind::SugaredDictionary:
972
- if (node->getNumChildren () == 1 ) {
975
+ if (node->getNumChildren () == 2 ) {
973
976
return Desugar (dem, node, Node::Kind::BoundGenericStructure,
974
977
Node::Kind::Structure, " Dictionary" );
975
978
}
@@ -2011,8 +2014,7 @@ bool TypeSystemSwiftTypeRef::IsPossibleDynamicType(opaque_compiler_type_t type,
2011
2014
NodePointer type_list = node->getLastChild ();
2012
2015
if (type_list->getKind () != Node::Kind::TypeList)
2013
2016
return false ;
2014
- for (size_t i = 0 ; i < type_list->getNumChildren (); ++i) {
2015
- NodePointer child = type_list->getChild (i);
2017
+ for (NodePointer child : *type_list) {
2016
2018
if (child->getKind () == Node::Kind::Type) {
2017
2019
child = child->getFirstChild ();
2018
2020
if (is_possible_dynamic (child))
0 commit comments