mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
fix(ast): incorrect visit order in function (#3681)
```ts
function hello<T>(a: T): T {
return 0 as T
}
```
The `T` is a type parameter. It can be used in `FormalParameters`, `ReturnType`, and `FunctionBody`. Therefore we need to visit `type_parameters` before visiting `FormalParameters`, `ReturnType`, and `FunctionBody`
This commit is contained in:
parent
09b92b6086
commit
215826874d
1 changed files with 3 additions and 3 deletions
|
|
@ -1247,13 +1247,13 @@ pub mod walk {
|
|||
if let Some(ident) = &func.id {
|
||||
visitor.visit_binding_identifier(ident);
|
||||
}
|
||||
if let Some(parameters) = &func.type_parameters {
|
||||
visitor.visit_ts_type_parameter_declaration(parameters);
|
||||
}
|
||||
visitor.visit_formal_parameters(&func.params);
|
||||
if let Some(body) = &func.body {
|
||||
visitor.visit_function_body(body);
|
||||
}
|
||||
if let Some(parameters) = &func.type_parameters {
|
||||
visitor.visit_ts_type_parameter_declaration(parameters);
|
||||
}
|
||||
if let Some(annotation) = &func.return_type {
|
||||
visitor.visit_ts_type_annotation(annotation);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue