Commit graph

24 commits

Author SHA1 Message Date
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
u9g
05bb29a11e
feat(query): Add fields (#807)
```diff
+ Expression.or_value_at_declaration

+ Function.body

```
2023-08-28 13:56:05 +08:00
u9g
1c6b87b415
feat(query): Unify spread types, add ExpressionArrayElement, and ancestors is nullish now (#788)
```diff

- ArrayElementAST
- SpreadArrayElement
- SpreadArrayElementAST
- SpreadIntoObject
- SpreadIntoObjectAST

+ ExpressionArrayElement
+ ExpressionArrayElement implements HasSpan
+ ExpressionArrayElement implements ArrayElement
+ ExpressionArrayElement.expression

+ ExpressionArrayElementAST
+ ExpressionArrayElementAST implements ArrayElement
+ ExpressionArrayElementAST implements HasSpan
+ ExpressionArrayElementAST implements ExpressionArrayElement

+ Spread
+ Spread implements ObjectProperty
+ Spread implements ArrayElement
+ Spread implements HasSpan
+ Spread.expression

+ SpreadAST
+ SpreadAST implements ObjectProperty
+ SpreadAST implements HasSpan
+ SpreadAST implements ArrayElement
+ SpreadAST implements ASTNode
+ SpreadAST implements Spread

```
2023-08-25 13:29:06 +08:00
u9g
e0a85eec01
feat(query): Add fields and new ArrayElement types (#787)
```diff
- Array.elements
+ Array.element

+ ElidedArrayElement
+ ElidedArrayElement implements ArrayElement
+ ElidedArrayElement implements HasSpan

+ ElidedArrayElementAST
+ ElidedArrayElementAST implements ArrayElement
+ ElidedArrayElementAST implements HasSpan
+ ElidedArrayElementAST implements ElidedArrayElement

+ SpreadArrayElement
+ SpreadArrayElement implements ArrayElement
+ SpreadArrayElement implements HasSpan
+ SpreadArrayElement.spread

+ SpreadArrayElementAST
+ SpreadArrayElementAST implements ArrayElement
+ SpreadArrayElementAST implements HasSpan
+ SpreadArrayElementAST implements SpreadArrayElement

+ VariableDeclarationAST.kind

```
2023-08-24 23:46:00 -04:00
u9g
4f686b6a75
feat(query): add Paren*Expr* type and add index to Argument type and fix todo in ObjectExpr (#780)
```diff
+ Argument.index

+ ParenthesizedExpression
+ ParenthesizedExpression implements Expression
+ ParenthesizedExpression implements HasSpan
+ ParenthesizedExpression.expression

+ ParenthesizedExpressionAST
+ ParenthesizedExpressionAST implements Expression
+ ParenthesizedExpressionAST implements HasSpan
+ ParenthesizedExpressionAST implements ParenthesizedExpression
+ ParenthesizedExpressionAST implements ASTNode
```
2023-08-24 04:21:02 +00:00
u9g
89d115704b
feat(query): Add types & Visit Array in AST for ArrayAST type (#777)
```diff
+ RegExpLiteral
+ RegExpLiteral implements HasSpan
+ RegExpLiteral implements Expression
+ RegExpLiteral.pattern

+ RegExpLiteralAST
+ RegExpLiteralAST implements ASTNode
+ RegExpLiteralAST implements RegExpLiteral
+ RegExpLiteralAST implements HasSpan
+ RegExpLiteralAST implements Expression
```
2023-08-23 09:27:49 -04:00
u9g
2b1e535e6d
feat(query) add declaration field to VarRef (#774) 2023-08-22 00:18:32 -04:00
u9g
8e6f84c40d
feat(query): Add new types (#770)
```diff
+ Array
+ Array implements HasSpan
+ Array implements Expression
+ Array.elements

+ ArrayAST
+ ArrayAST implements Expression
+ ArrayAST implements ASTNode
+ ArrayAST implements HasSpan
+ ArrayAST implements Array

+ ArrayElement
+ ArrayElement implements HasSpan

+ ArrayElementAST
+ ArrayElementAST implements HasSpan
+ ArrayElementAST implements ASTNode

+ File.expression

+ StringLiteral
+ StringLiteral implements Expression
+ StringLiteral implements HasSpan

+ StringLiteralAST
+ StringLiteralAST implements Expression
+ StringLiteralAST implements ASTNode
+ StringLiteralAST implements HasSpan
+ StringLiteralAST implements StringLiteral

+ TemplateLiteral
+ TemplateLiteral implements HasSpan
+ TemplateLiteral implements Expression

+ TemplateLiteralAST
+ TemplateLiteralAST implements ASTNode
+ TemplateLiteralAST implements TemplateLiteral
+ TemplateLiteralAST implements Expression
+ TemplateLiteralAST implements HasSpan

```
2023-08-21 03:50:05 +00:00
u9g
3b3babed2e
feat(query): Add types and add field to Argument (#765)
```diff
+ Argument.is_spread

+ DoWhileStatement
+ DoWhileStatement implements HasSpan
+ DoWhileStatement implements Statement
+ DoWhileStatement.body
+ DoWhileStatement.condition

+ DoWhileStatementAST
+ DoWhileStatementAST implements HasSpan
+ DoWhileStatementAST implements Statement
+ DoWhileStatementAST implements DoWhileStatement
+ DoWhileStatementAST implements ASTNode

+ ForStatement
+ ForStatement implements HasSpan
+ ForStatement implements Statement
+ ForStatement.body
+ ForStatement.step
+ ForStatement.condition

+ ForStatementAST
+ ForStatementAST implements HasSpan
+ ForStatementAST implements Statement
+ ForStatementAST implements ASTNode
+ ForStatementAST implements ForStatement

+ New
+ New implements Expression
+ New implements HasSpan
+ New.callee
+ New.argument

+ NewAST
+ NewAST implements Expression
+ NewAST implements HasSpan
+ NewAST implements New
+ NewAST implements ASTNode

+ TernaryExpression
+ TernaryExpression implements HasSpan
+ TernaryExpression implements Expression
+ TernaryExpression.condition
+ TernaryExpression.if_true
+ TernaryExpression.if_false

+ TernaryExpressionAST
+ TernaryExpressionAST implements TernaryExpression
+ TernaryExpressionAST implements HasSpan
+ TernaryExpressionAST implements ASTNode
+ TernaryExpressionAST implements Expression

+ Throw
+ Throw implements HasSpan
+ Throw implements Expression
+ Throw.to_throw

+ ThrowAST
+ ThrowAST implements HasSpan
+ ThrowAST implements Throw
+ ThrowAST implements ASTNode
+ ThrowAST implements Expression

```
2023-08-20 14:54:25 +08:00
u9g
fd3fa6ca84
feat(query): Add some new types (#761)
```diff
+ BlockStatement
+ BlockStatement implements HasSpan
+ BlockStatement implements Statement
+ BlockStatement.statement

+ BlockStatementAST
+ BlockStatementAST implements BlockStatement
+ BlockStatementAST implements Statement
+ BlockStatementAST implements ASTNode
+ BlockStatementAST implements HasSpan

+ ExpressionStatement
+ ExpressionStatement implements HasSpan
+ ExpressionStatement implements Statement
+ ExpressionStatement.expression

+ ExpressionStatementAST
+ ExpressionStatementAST implements HasSpan
+ ExpressionStatementAST implements ExpressionStatement
+ ExpressionStatementAST implements ASTNode
+ ExpressionStatementAST implements Statement

+ VarRef
+ VarRef implements HasSpan
+ VarRef implements Expression
+ VarRef.name

+ VarRefAST
+ VarRefAST implements HasSpan
+ VarRefAST implements Expression
+ VarRefAST implements VarRef
+ VarRefAST implements ASTNode

+ WhileStatement
+ WhileStatement implements Statement
+ WhileStatement implements HasSpan
+ WhileStatement.condition
+ WhileStatement.body

+ WhileStatementAST
+ WhileStatementAST implements ASTNode
+ WhileStatementAST implements Statement
+ WhileStatementAST implements WhileStatement
+ WhileStatementAST implements HasSpan

```
2023-08-19 16:15:22 +08:00
u9g
61bf583333
feat(query): New types added (#754)
```diff
+ LogicalExpression
+ LogicalExpression implements HasSpan
+ LogicalExpression implements Expression
+ LogicalExpression.operator
+ LogicalExpression.left
+ LogicalExpression.right

+ LogicalExpressionAST
+ LogicalExpressionAST implements LogicalExpression
+ LogicalExpressionAST implements ASTNode
+ LogicalExpressionAST implements Expression
+ LogicalExpressionAST implements HasSpan

+ Parameter implements HasSpan

+ UnaryExpression
+ UnaryExpression implements HasSpan
+ UnaryExpression implements Expression
+ UnaryExpression.operator
+ UnaryExpression.value

+ UnaryExpressionAST
+ UnaryExpressionAST implements ASTNode
+ UnaryExpressionAST implements Expression
+ UnaryExpressionAST implements HasSpan
+ UnaryExpressionAST implements UnaryExpression
```
2023-08-18 00:04:52 -04:00
u9g
b346a9ad6d
feat(query): New types and new fields for existing types (#746)
```diff
+ Argument.value
+ Argument implements HasSpan
+ ArgumentAST

- FnCall.arguments
+ FnCall.argument
- FnCallAST.arguments
+ FnCallAST.argument

+ interface Function
+ Function.is_async
+ Function.is_generator
+ Function.parameter
+ Function implements Expression
+ Function implements HasSpan

+ Parameter
+ Parameter.is_readonly
+ Parameter.assignment
+ Parameter.type_annotation
+ Parameter implements HasSpan
+ ParameterAST

+ ArrowFunction implements Function
+ ArrowFunction implements Expression
+ ArrowFunctionAST implements Function
+ ArrowFunctionAST implements Expression


+ FnDeclaration implements Function
+ FnDeclaration implements Expression
+ FnDeclarationAST implements Function
+ FnDeclarationAST implements Expression
```
2023-08-16 00:56:43 -04:00
u9g
5dc69ea4ec
feat(query): Add many types (#742) 2023-08-15 03:30:59 -04:00
u9g
99a7ad4319
feat(query): add FnCall and Argument types (#737) 2023-08-14 10:25:03 +08:00
u9g
087abd3cf1
feat(query): Add Reassignment type and add str property to span (#731) 2023-08-13 22:18:41 +08:00
u9g
9566378119
feat(query): add many types to oxc_query (#724)
Adds `Name(AST)?`, `IfStatementAST`, `SpreadIntoObject(AST)?`,
`ObjectEntry(AST)?`, `DotProperty(AST)?` types

Fixes `ObjectLiteral`'s value field's output type

Added `entry` field to `ObjectLiteral(AST)?`
2023-08-12 16:43:58 +08:00
u9g
c6ed90900c
feat(query): Add name to class (#720) 2023-08-11 14:36:40 +08:00
u9g
97c5cd379e
feat(query): Add right to VariableDeclaration (#718) 2023-08-11 05:40:35 +00:00
u9g
9c05866cc1
feat(query): add NumberLiteral type (#717) 2023-08-11 05:37:29 +00:00
u9g
c7fc1d99b5
feat(query): add name to interface (#716) 2023-08-11 05:22:12 +00:00
u9g
a953a96529
fix(query): make ObjectLiteralAST implement ObjectLiteral (#715) 2023-08-11 05:15:22 +00:00
u9g
228cab9269
feat(query): add ast counterpart to ObjectLiteral (#666) 2023-07-30 18:15:57 -04:00
u9g
451667acfc
feat(query): impl ASTNode for VariableDeclarationAST (#639)
also changes from using entire_span to just span so we don't have to
have two properties point at the same span
2023-07-27 11:30:15 +08:00
u9g
1d504ac94a
Add oxc_query crate (#625) 2023-07-26 13:03:00 +08:00