mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
fix(semantic): align visit_arrow_function_expression field visit order with ast (#4366)
related: #4364
This commit is contained in:
parent
f68b659713
commit
6ffce865d1
8 changed files with 59 additions and 26 deletions
|
|
@ -1571,6 +1571,10 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
|
|||
self.enter_node(kind);
|
||||
self.enter_scope(ScopeFlags::Function | ScopeFlags::Arrow, &expr.scope_id);
|
||||
|
||||
if let Some(parameters) = &expr.type_parameters {
|
||||
self.visit_ts_type_parameter_declaration(parameters);
|
||||
}
|
||||
|
||||
self.visit_formal_parameters(&expr.params);
|
||||
|
||||
/* cfg */
|
||||
|
|
@ -1581,6 +1585,10 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
|
|||
));
|
||||
/* cfg */
|
||||
|
||||
if let Some(return_type) = &expr.return_type {
|
||||
self.visit_ts_type_annotation(return_type);
|
||||
}
|
||||
|
||||
self.visit_function_body(&expr.body);
|
||||
|
||||
/* cfg */
|
||||
|
|
@ -1592,9 +1600,6 @@ impl<'a> Visit<'a> for SemanticBuilder<'a> {
|
|||
});
|
||||
/* cfg */
|
||||
|
||||
if let Some(parameters) = &expr.type_parameters {
|
||||
self.visit_ts_type_parameter_declaration(parameters);
|
||||
}
|
||||
self.leave_node(kind);
|
||||
self.leave_scope();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,16 +11,9 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"id": 1,
|
||||
"node": "ArrowFunctionExpression",
|
||||
"symbols": [
|
||||
{
|
||||
"flag": "SymbolFlags(BlockScopedVariable)",
|
||||
"id": 1,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator",
|
||||
"references": []
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(TypeParameter)",
|
||||
"id": 2,
|
||||
"id": 1,
|
||||
"name": "T",
|
||||
"node": "TSTypeParameter",
|
||||
"references": [
|
||||
|
|
@ -28,9 +21,16 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 13
|
||||
"node_id": 16
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(BlockScopedVariable)",
|
||||
"id": 2,
|
||||
"name": "x",
|
||||
"node": "VariableDeclarator",
|
||||
"references": []
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,18 +11,25 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"id": 1,
|
||||
"node": "ArrowFunctionExpression",
|
||||
"symbols": [
|
||||
{
|
||||
"flag": "SymbolFlags(FunctionScopedVariable)",
|
||||
"id": 1,
|
||||
"name": "a",
|
||||
"node": "FormalParameter",
|
||||
"references": []
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(TypeParameter)",
|
||||
"id": 2,
|
||||
"id": 1,
|
||||
"name": "T",
|
||||
"node": "TSTypeParameter",
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 14
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(FunctionScopedVariable)",
|
||||
"id": 2,
|
||||
"name": "a",
|
||||
"node": "FormalParameter",
|
||||
"references": []
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"id": 1,
|
||||
"name": "T",
|
||||
"node": "TSTypeParameter",
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 12
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 14
|
||||
"node_id": 12
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -37,7 +37,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"id": 0,
|
||||
"name": "T",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 18
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 0,
|
||||
"name": "arg",
|
||||
"node_id": 14
|
||||
"node_id": 18
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"flag": "ReferenceFlag(Read)",
|
||||
"id": 0,
|
||||
"name": "arg",
|
||||
"node_id": 17
|
||||
"node_id": 23
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -44,7 +44,14 @@ input_file: crates/oxc_semantic/tests/fixtures/typescript-eslint/functions/arrow
|
|||
"id": 0,
|
||||
"name": "T",
|
||||
"node": "TSTypeAliasDeclaration",
|
||||
"references": []
|
||||
"references": [
|
||||
{
|
||||
"flag": "ReferenceFlag(Type)",
|
||||
"id": 0,
|
||||
"name": "T",
|
||||
"node_id": 18
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"flag": "SymbolFlags(BlockScopedVariable | ConstVariable)",
|
||||
|
|
|
|||
Loading…
Reference in a new issue