如何解决CodeQL“否则”式构造?
我是 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 ])
}
我觉得我那小小的命令式程序员的大脑一定错过了一直盯着我脸的东西。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。