Skip to content

Commit 8df657c

Browse files
authored
Merge pull request #217 from calumgrant/cs/make_stubs
C#: Tool to generate stubs for qltests
2 parents 0e25649 + 2fdf766 commit 8df657c

File tree

6 files changed

+744
-0
lines changed

6 files changed

+744
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Tool to generate C# stubs from a qltest snapshot.
3+
*
4+
* It finds all declarations used in the source code,
5+
* and generates minimal C# stubs containing those declarations
6+
* and their dependencies.
7+
*/
8+
9+
import csharp
10+
import Stubs
11+
12+
/** Declarations used by source code. */
13+
class UsedInSource extends GeneratedDeclaration {
14+
UsedInSource() {
15+
(
16+
this = any(Access a).getTarget()
17+
or
18+
this = any(Call c).getTarget()
19+
or
20+
this = any(TypeMention tm).getType()
21+
or
22+
exists(Virtualizable v | v.fromSource() | this = v.getImplementee() or this = v.getOverridee())
23+
or
24+
this = any(Attribute a).getType().getAConstructor()
25+
)
26+
and
27+
this.fromLibrary()
28+
}
29+
}
30+
31+
select generatedCode()

0 commit comments

Comments
 (0)