oxc/crates/oxc_query
u9g 9a5bb008e7
feat(query): Add is_getter, is_setter, is_constructor to all Function implementors (#1526)
---

<details open="true"><summary>Generated summary (powered by <a href="https://app.graphite.dev">Graphite</a>)</summary>

> # TL;DR
> This pull request adds new properties to the `ArrowFunction`, `FnDeclaration`, and `Function` interfaces in the Trustfall schema. It also adds implementation for resolving these properties in the `adapter.rs` and `properties.rs` files. Additionally, it adds a new method `function_scope_flag` to the `Vertex` struct in the `vertex.rs` file.
> 
> # What changed
> - Added new properties (`is_getter`, `is_setter`, `is_constructor`) to the `ArrowFunction`, `FnDeclaration`, and `Function` interfaces in the Trustfall schema.
> - Implemented the resolution of these properties in the `resolve_arrow_function_property`, `resolve_fn_declaration_property`, and `resolve_function_property` functions in the `properties.rs` file.
> - Added a new method `function_scope_flag` to the `Vertex` struct in the `vertex.rs` file.
> 
> # How to test
> 1. Run the test suite to ensure that all existing tests pass.
> 2. Add new tests to cover the newly added properties and the `function_scope_flag` method.
> 3. Run the test suite again and ensure that all tests pass.
> 
> # Why make this change
> - The new properties (`is_getter`, `is_setter`, `is_constructor`) provide additional information about functions in the Trustfall schema, allowing clients to query for these properties.
> - The `function_scope_flag` method in the `Vertex` struct provides a convenient way to access the scope flags of a function node, which can be useful for various analysis and processing tasks.
</details>
2023-11-27 12:22:41 +08:00
..
examples fix(parser,semantic): make semantic own Trivias (#711) 2023-08-10 15:30:32 +08:00
src feat(query): Add is_getter, is_setter, is_constructor to all Function implementors (#1526) 2023-11-27 12:22:41 +08:00
Cargo.toml refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
README.md

oxc_query

What is this?

oxc_query is a trustfall adapter which can be used for querying data about code.

Example: Query the name of every variable declared in a js/ts/tsx file

query {
    File {
        variable_declaration {
            left {
                assignment_to_variable_name @filter(op: "is_not_null") @output # we filter not null because destructured variables will be null when outputted on this edge.
            }
        }
    }
}

Hint: See example/simple.rs for how to run this query.