限定在指定文件中搜索

    1. import javascript
    2. from MethodCallExpr call
    3. where call.getFile().getBaseName() = "string-manipulations.js"
    4. select call

    递归寻找使用location的表达式

    1. import javascript
    2. Expr useLocation(Expr call) {
    3. call.getAChildExpr().toString() = "location" and result = call
    4. or call = useLocation(result.getAChildExpr())
    5. }
    6. from MethodCallExpr call, int i
    7. where call.getFile().getBaseName() = "string-manipulations.js"
    8. select call, useLocation(call.getArgument(i))