4

是否可以or在函数声明中使用?喜欢:

functionDecl(hasName("a") or hasName("b"))

或者我们必须使用addMatcher添加更多匹配器来获得相同的结果?

4

1 回答 1

10

有几种缩小匹配器形成其他匹配器的逻辑组合:anyOf类似于“或”,allOf可以实现“与”,unless类似于“非”。您的示例可能看起来像

functionDecl(
  anyOf(
    hasName("a"),
    hasName("b") ))
于 2017-08-03T23:04:56.627 回答