Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CS] Avoid CA2200 warning when rethrowing #9999

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/core/tType.ml
Original file line number Diff line number Diff line change
Expand Up @@ -400,4 +400,5 @@ type flag_tclass_field =
type flag_tvar =
| VCaptured
| VFinal
| VUsed (* used by the analyzer *)
| VUsed (* used by the analyzer *)
| VCaught
3 changes: 2 additions & 1 deletion src/filters/exceptions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ let catch_native ctx catches t p =
(* Everything else falls into `if(Std.is(e, ExceptionType)`-fest *)
| rest ->
let catch_var = alloc_var VGenerated "`" ctx.wildcard_catch_type null_pos in
add_var_flag catch_var VCaught;
let catch_local = mk (TLocal catch_var) catch_var.v_type null_pos in
let body =
let catch = new catch ctx catch_local p in
Expand Down Expand Up @@ -570,4 +571,4 @@ let patch_constructors tctx =
)
| _ -> ()
)
| _ -> (fun _ -> ())
| _ -> (fun _ -> ())
2 changes: 2 additions & 0 deletions src/generators/gencs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,8 @@ let generate con =
| TContinue -> write w "continue"
| TThrow { eexpr = TIdent "__rethrow__" } ->
write w "throw"
| TThrow { eexpr = TLocal(v) } when (has_var_flag v VCaught) ->
write w "throw";
| TThrow e ->
write w "throw ";
expr_s w e
Expand Down