Skip to content

Commit

Permalink
WIP: check subsequence returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Mersho committed Nov 27, 2023
1 parent e13b307 commit bcdb16d
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,26 @@ open FSharp.Compiler.Text
open FSharpLint.Framework.Ast
open FSharpLint.Framework.Rules

let isIdentifierExecptionRaise (identifer: Ident) =
identifer.idText = "failwith"
|| identifer.idText = "failwithf"
|| identifer.idText = "raise"


let checkSequentialExpression (expression: SynExpr) (range: range) =
match expression with
| SynExpr.App (_, _, SynExpr.Ident failwithId, _, _) when
failwithId.idText = "failwith"
|| failwithId.idText = "failwithf"
|| failwithId.idText = "raise"
isIdentifierExecptionRaise failwithId
->
{ Range = range
Message = Resources.GetString "RulesAsyncExceptionWithoutReturn"
SuggestedFix = None
TypeChecks = List.Empty }
|> Array.singleton
// WIP
//| SynExpr.YieldOrReturn (_, SynExpr.App (_, _, SynExpr.Ident identifier, _, _), range) when
// isIdentifierExecptionRaise identifier ->

| _ -> Array.empty


Expand Down Expand Up @@ -58,6 +66,7 @@ let rec checkExpression (expression: SynExpr) (range: range) =


let runner args =
printf "________%A" args.AstNode
match args.AstNode with
| AstNode.Expression
(
Expand Down

0 comments on commit bcdb16d

Please sign in to comment.