Skip to content

Commit aa54e4b

Browse files
committed
Swift: add some typing information to PrintAst
1 parent a237f69 commit aa54e4b

File tree

2 files changed

+432
-0
lines changed

2 files changed

+432
-0
lines changed

swift/ql/lib/codeql/swift/printast/PrintAstNode.qll

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,25 @@ class PrintExpr extends PrintLocatable {
141141
child = TConversionContainer(ast)
142142
}
143143
}
144+
145+
/**
146+
* A specialization of graph node for `VarDecl`, to add typing information.
147+
*/
148+
class PrintVarDecl extends PrintLocatable {
149+
override VarDecl ast;
150+
151+
override string getProperty(string key) {
152+
key = "getType()" and result = ast.getType().toString()
153+
}
154+
}
155+
156+
/**
157+
* A specialization of graph node for `AbstractFunctionDecl`, to add typing information.
158+
*/
159+
class PrintCallable extends PrintLocatable {
160+
override AbstractFunctionDecl ast;
161+
162+
override string getProperty(string key) {
163+
key = "getInterfaceType()" and result = ast.getInterfaceType().toString()
164+
}
165+
}

0 commit comments

Comments
 (0)