我是CodeQL的新手,还在努力想办法解决这个问题。在半频繁的基础上,我发现自己需要一个支持指定“回退值”的语言结构来实现以下逻辑:
foot Foo(...) {
result = A
or
not eists(foot t | t = A) and
result = B
or
not eists(foot t | t = A) and
not eists(foot t | t = B) and
result = C
}
// aka
foot Foo(...) {
if eists(foot t | t = A) then
result = A
else if eists(foot t | t = B) then
result = B
else
result = C
}CodeQL是否提供了一种以更优雅的方式对此进行重新表述的方法?我一遍又一遍地浏览了这些文档,寻找类似于以下内容的内容,但没有结果:
foot Foo(...) {
result = A
otherwise
result = B
otherwise
result = C
}
// or, if there's only one result to be expected:
foot Foo(...) {
result = first([ A, B, C ])
}我觉得我的小程序员的大脑一定是遗漏了一些一直盯着我的脸的东西。
https://stackoverflow.com/questions/68455221
复制相似问题