You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's situiation that we need turn a identifier a into various form depend on the conditions. And we want to apply the span of a to the final form. The current solution make it complex to do it.
let span_of_a = a.span;let expr = if rewrite_to_member_expr {member_expr!(a, SPAN)}else{
a
}let expr = if is_callee {member_expr_again!(expr, SPAN)}else{
expr
};
expr.span = span_of_a;
You will see we have to apply the span of a in the end, otherwise the sourcemap might be wrong, which is caused by nested ast nodes have the same span. I guess this is allowed maybe? But it's doesn't generate accurate sourcemap.
The text was updated successfully, but these errors were encountered:
Closes#4606.
Introduce `GetSpanMut` trait and implement it on all AST node types.
This has to be a separate trait, rather than adding `span_mut` method to `GetSpan` because `AstKind` implements `GetSpan`, and it only has an immutable `&` ref to AST node it contains.
There's situiation that we need turn a identifier
a
into various form depend on the conditions. And we want to apply thespan
ofa
to the final form. The current solution make it complex to do it.You will see we have to apply the
span
ofa
in the end, otherwise the sourcemap might be wrong, which is caused by nested ast nodes have the same span. I guess this is allowed maybe? But it's doesn't generate accurate sourcemap.The text was updated successfully, but these errors were encountered: