Skip to content

Commit d28c9fc

Browse files
authored
Merge pull request #5473 from nkcsgexi/digester-cleanup
2 parents d49a246 + a0678c3 commit d28c9fc

File tree

4 files changed

+13
-4
lines changed

4 files changed

+13
-4
lines changed

test/api-digester/Inputs/cake1.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public struct S1 {
77

88
public class C1 {
99
public class func foo1() {}
10+
public func foo2(_ : Int) {}
1011
}

test/api-digester/Inputs/cake2.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ public struct S1 {
77

88
public class C1 {
99
public func foo1() {}
10+
public func foo2(_ : ()->()) {}
1011
}

test/api-digester/Outputs/Cake.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
==================================================== Type Changes ====================================================
99
Constructor S1.init(_:) has 1st parameter type change from Int to Double
10+
Func C1.foo2(_:) has 1st parameter type change from Int to () -> ()
1011

1112
==================================================== Decl Attribute changes ====================================================
1213
Func C1.foo1() is now not static

tools/swift-api-digester/swift-api-digester.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,16 +2001,22 @@ class PrunePass : public MatchedNodeListener, public SDKTreeDiffPass {
20012001
}
20022002

20032003
virtual void foundMatch(NodePtr Left, NodePtr Right) override {
2004+
Left->annotate(NodeAnnotation::Updated);
2005+
Right->annotate(NodeAnnotation::Updated);
2006+
// Push the updated node to the map for future reference.
2007+
UpdateMap->foundMatch(Left, Right);
2008+
2009+
if (Left->getKind() != Right->getKind()) {
2010+
assert(isa<SDKNodeType>(Left) && isa<SDKNodeType>(Right) &&
2011+
"only type nodes can match across kinds.");
2012+
return;
2013+
}
20042014
assert(Left->getKind() == Right->getKind());
20052015
SDKNodeKind Kind = Left->getKind();
20062016
assert(Left->getKind() != SDKNodeKind::Nil &&
20072017
Right->getKind() != SDKNodeKind::Nil);
20082018
assert(Kind == SDKNodeKind::Root || *Left != *Right);
20092019

2010-
Left->annotate(NodeAnnotation::Updated);
2011-
Right->annotate(NodeAnnotation::Updated);
2012-
// Push the updated node to the map for future reference.
2013-
UpdateMap->foundMatch(Left, Right);
20142020
detectRename(Left, Right);
20152021
detectThrowing(Left, Right);
20162022
detectMutating(Left, Right);

0 commit comments

Comments
 (0)