mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Add basic parsing, sema and mangling support for throwing function types. Next up, metadata and serialization support, as well as more tests.
Swift SVN r26767
This commit is contained in:
@@ -1589,6 +1589,11 @@ private:
|
||||
}
|
||||
|
||||
NodePointer demangleFunctionType(Node::Kind kind) {
|
||||
bool throws = false;
|
||||
if (Mangled &&
|
||||
Mangled.nextIf('z')) {
|
||||
throws = true;
|
||||
}
|
||||
NodePointer in_args = demangleType();
|
||||
if (!in_args)
|
||||
return nullptr;
|
||||
@@ -1596,6 +1601,11 @@ private:
|
||||
if (!out_args)
|
||||
return nullptr;
|
||||
NodePointer block = NodeFactory::create(kind);
|
||||
|
||||
if (throws) {
|
||||
block->addChild(NodeFactory::create(Node::Kind::ThrowsAnnotation));
|
||||
}
|
||||
|
||||
NodePointer in_node = NodeFactory::create(Node::Kind::ArgumentTuple);
|
||||
block->addChild(in_node);
|
||||
in_node->addChild(in_args);
|
||||
@@ -2312,6 +2322,7 @@ private:
|
||||
case Node::Kind::Weak:
|
||||
case Node::Kind::WillSet:
|
||||
case Node::Kind::WitnessTableOffset:
|
||||
case Node::Kind::ThrowsAnnotation:
|
||||
return false;
|
||||
}
|
||||
unreachable("bad node kind");
|
||||
@@ -3277,6 +3288,10 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
|
||||
Printer << '.' << pointer->getText();
|
||||
return;
|
||||
}
|
||||
case Node::Kind::ThrowsAnnotation: {
|
||||
Printer<< " throws ";
|
||||
return;
|
||||
}
|
||||
}
|
||||
unreachable("bad node kind!");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user