@@ -555,17 +555,26 @@ let rec convertNode tryImplicitConv (model: SemanticModel) (node: SyntaxNode) :
555
555
ExprInfixApp( node, e1, ValId " ?." , e2)
556
556
| TryStatementSyntax (_, body, catches, finallyBody) ->
557
557
let getMatch = function
558
- | CatchClauseSyntax (_, CatchDeclarationSyntax (_, t , tok ,_) , filter, block) as catchNode ->
558
+ | CatchClauseSyntax (_, catchDecl , filter, block) as catchNode ->
559
559
let exprFilter = match filter with | CatchFilterClauseSyntax(_,_, x,_) -> Some x |_ -> None
560
- let ident = let x = tok.ValueText in if String.isNullOrEmpty x then PatWildcard catchNode else mkPatBind catchNode x
561
- let typeCheckPat = function
562
- | PatWithType( ctx, t, PatWildcard ctx1) -> PatWithType( ctx, t, PatWildcard ctx1)
563
- | PatWithType( ctx, t, PatBind ( ctx1, x)) -> PatBindAs( ctx, x, PatWithType( ctx1, t, PatWildcard ctx1))
564
- | x -> failwithf " Unexpected case %A " x
560
+ let basePat =
561
+ match catchDecl with
562
+ | CatchDeclarationSyntax(_, t, tok,_) ->
563
+ let ident =
564
+ let x = tok.ValueText in
565
+ if String.isNullOrEmpty x then PatWildcard catchNode
566
+ else mkPatBind catchNode x
567
+ let typeCheckPat = function
568
+ | PatWithType( ctx, t, PatWildcard ctx1) -> PatWithType( ctx, t, PatWildcard ctx1)
569
+ | PatWithType( ctx, t, PatBind ( ctx1, x)) -> PatBindAs( ctx, x, PatWithType( ctx1, t, PatWildcard ctx1))
570
+ | x -> failwithf " Unexpected case %A " x
571
+ ident |> getTypePat ( set[]) t |> typeCheckPat
572
+ | null -> PatWildcard catchNode
573
+
565
574
let exprFilterO = exprFilter |> Option.map descend
566
575
let blockRes , block = descend block
567
576
[ yield Some blockRes; yield exprFilterO |> Option.map fst ] |> Seq.choose id |> collectResults,
568
- ( catchNode, ident |> getTypePat ( set []) t |> typeCheckPat , exprFilterO |> Option.map snd, block)
577
+ ( catchNode, basePat , exprFilterO |> Option.map snd, block)
569
578
570
579
let catches = catches |> List.map getMatch
571
580
let finallyBodyO = finallyBody |> Option.ofObj |> Option.map descend
0 commit comments