summaryrefslogtreecommitdiff
path: root/tests/examplefiles/example.boa
blob: a18f1626df11d33d51c76621208980c90c814828 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Computes Number of Public Methods (NPM) for each project, per-type
# Output is: NPM[ProjectID][TypeName] = NPM value
p: Project = input;
NPM: output sum[string][string] of int;

visit(p, visitor {
	# only look at the latest snapshot
	before n: CodeRepository -> {
		snapshot := getsnapshot(n);
		foreach (i: int; def(snapshot[i]))
			visit(snapshot[i]);
		stop;
	}
	before node: Declaration ->
		if (node.kind == TypeKind.CLASS)
			foreach (i: int; has_modifier_public(node.methods[i]))
				NPM[p.id][node.name] << 1;
});