Files
codeql/swift/ql/test/library-tests/elements/decl/enumdecl/enumdecl.ql
2023-05-17 19:21:41 +01:00

26 lines
797 B
Plaintext

import swift
string describe(Decl d) {
d instanceof EnumDecl and result = "(EnumDecl)"
or
d instanceof EnumCaseDecl and result = "(EnumCaseDecl)"
or
d instanceof EnumElementDecl and result = "(EnumElementDecl)"
or
result = ".getType = " + d.(EnumDecl).getType().toString()
or
result = ".getDeclaringDecl = " + d.getDeclaringDecl().toString()
or
exists(int i |
result = ".getElement(" + i.toString() + ") = " + d.(EnumCaseDecl).getElement(i).toString()
or
result = ".getParam(" + i.toString() + ") = " + d.(EnumElementDecl).getParam(i).toString()
or
result = ".getEnumElement(" + i.toString() + ") = " + d.(EnumDecl).getEnumElement(i).toString()
)
}
from Decl d
where d.getLocation().getFile().getName() != ""
select d, strictconcat(describe(d), ", ")