swift-api-digester: allow function types to be matched with other types.

This commit is contained in:
Xi Ge
2016-10-25 22:21:27 -07:00
parent 63c341892e
commit a0678c349c
4 changed files with 13 additions and 4 deletions

View File

@@ -2001,16 +2001,22 @@ public:
}
virtual void foundMatch(NodePtr Left, NodePtr Right) override {
Left->annotate(NodeAnnotation::Updated);
Right->annotate(NodeAnnotation::Updated);
// Push the updated node to the map for future reference.
UpdateMap->foundMatch(Left, Right);
if (Left->getKind() != Right->getKind()) {
assert(isa<SDKNodeType>(Left) && isa<SDKNodeType>(Right) &&
"only type nodes can match across kinds.");
return;
}
assert(Left->getKind() == Right->getKind());
SDKNodeKind Kind = Left->getKind();
assert(Left->getKind() != SDKNodeKind::Nil &&
Right->getKind() != SDKNodeKind::Nil);
assert(Kind == SDKNodeKind::Root || *Left != *Right);
Left->annotate(NodeAnnotation::Updated);
Right->annotate(NodeAnnotation::Updated);
// Push the updated node to the map for future reference.
UpdateMap->foundMatch(Left, Right);
detectRename(Left, Right);
detectThrowing(Left, Right);
detectMutating(Left, Right);