@@ -6,16 +6,16 @@ open FSharp.Compiler.SyntaxTree
66
77module CosmosCodeAnalysis =
88
9- let dotConcat = List.map( fun ( id : Ident ) -> id.idText) >> String.concat " ."
9+ let dotConcat =
10+ List.map ( fun ( id : Ident ) -> id.idText)
11+ >> String.concat " ."
1012
1113 let checkIfApply funcExpr argExpr range =
1214 match funcExpr with
13- | SynExpr.Ident ident ->
14- Some( ident.idText, argExpr, funcExpr.Range, range)
15+ | SynExpr.Ident ident -> Some( ident.idText, argExpr, funcExpr.Range, range)
1516 | SynExpr.LongIdent (_, LongIdentWithDots ( listOfIds, _), _, _) ->
1617 Some( dotConcat listOfIds, argExpr, funcExpr.Range, range)
17- | _ ->
18- None
18+ | _ -> None
1919
2020 let (| Apply | _ |) synExpr =
2121 match synExpr with
@@ -25,80 +25,91 @@ module CosmosCodeAnalysis =
2525
2626 let (| LongIdent | _ |) =
2727 function
28- | SynExpr.LongIdent ( isOptional, LongIdentWithDots ( listOfIds, ranges), altName, identRange) ->
29- Some( dotConcat listOfIds, range)
30- | _ ->
31- None
28+ | SynExpr.LongIdent (_, LongIdentWithDots ( listOfIds, _), _, _) -> Some( dotConcat listOfIds, range)
29+ | _ -> None
3230
3331 let (| Query | _ |) =
3432 function
35- | Apply ( " Cosmos.query" , SynExpr.Const ( SynConst.String ( query, queryRange), constRange), range, appRange) -> Some( query, constRange)
33+ | Apply ( " Cosmos.query" , SynExpr.Const ( SynConst.String ( query, _), constRange), _, _) ->
34+ Some( query, constRange)
3635 | _ -> None
3736
3837 let (| LiteralQuery | _ |) =
3938 function
40- | Apply ( " Cosmos.query" , SynExpr.Ident ( identifier), funcRange, appRange ) -> Some( identifier.idText, funcRange)
39+ | Apply ( " Cosmos.query" , SynExpr.Ident ( identifier), funcRange, _ ) -> Some( identifier.idText, funcRange)
4140 | _ -> None
4241
4342 let (| TypedQuery | _ |) synExpr =
4443 match synExpr with
45- | SynExpr.App (_, _, ( SynExpr.TypeApp ( SynExpr.LongIdent (_, LongIdentWithDots ( listOfIds, _), _, _), _, typeNames, _, _, _, typeAppRange)), SynExpr.Const ( SynConst.String ( query, _), _), _) ->
44+ | SynExpr.App (_,
45+ _,
46+ ( SynExpr.TypeApp ( SynExpr.LongIdent (_, LongIdentWithDots ( listOfIds, _), _, _),
47+ _,
48+ typeNames,
49+ _,
50+ _,
51+ _,
52+ typeAppRange)),
53+ SynExpr.Const ( SynConst.String ( query, _), _),
54+ _) ->
4655 match dotConcat listOfIds with
4756 | " Cosmos.query" ->
4857 let names =
4958 typeNames
5059 |> List.choose ( fun typeName ->
5160 match typeName with
52- | SynType.LongIdent ( LongIdentWithDots ( listOfIds, _)) ->
53- dotConcat listOfIds |> Some
54- | _ ->
55- None)
61+ | SynType.LongIdent ( LongIdentWithDots ( listOfIds, _)) -> dotConcat listOfIds |> Some
62+ | _ -> None)
5663
5764 Some( names, query, typeAppRange)
5865 | _ -> None
59- | _ ->
60- None
66+ | _ -> None
6167
6268 let (| Database | _ |) =
6369 function
64- | Apply ( " Cosmos.database" , SynExpr.Const ( SynConst.String ( dbId, queryRange), constRange), range, appRange) -> Some( dbId, constRange)
70+ | Apply ( " Cosmos.database" , SynExpr.Const ( SynConst.String ( dbId, _), constRange), _, _) ->
71+ Some( dbId, constRange)
6572 | _ -> None
6673
6774 let (| LiteralDatabase | _ |) =
6875 function
69- | Apply ( " Cosmos.database" , SynExpr.Ident ( identifier), funcRange, appRange ) -> Some( identifier.idText, funcRange)
76+ | Apply ( " Cosmos.database" , SynExpr.Ident ( identifier), funcRange, _ ) -> Some( identifier.idText, funcRange)
7077 | _ -> None
7178
7279 let (| Container | _ |) =
7380 function
74- | Apply ( " Cosmos.container" , SynExpr.Const ( SynConst.String ( containerName, queryRange ), constRange), range , appRange ) ->
81+ | Apply ( " Cosmos.container" , SynExpr.Const ( SynConst.String ( containerName, _ ), constRange), _, _ ) ->
7582 Some( containerName, constRange)
7683 | _ -> None
7784
7885 let (| LiteralContainer | _ |) =
7986 function
80- | Apply ( " Cosmos.container" , SynExpr.Ident ( identifier), funcRange, appRange ) -> Some( identifier.idText, funcRange)
87+ | Apply ( " Cosmos.container" , SynExpr.Ident ( identifier), funcRange, _ ) -> Some( identifier.idText, funcRange)
8188 | _ -> None
8289
8390 let (| ParameterTuple | _ |) =
8491 function
85- | SynExpr.Tuple ( isStruct,
86- [ SynExpr.Const ( SynConst.String ( parameterName, paramRange), constRange); Apply ( funcName, exprArgs, funcRange, appRange) ],
87- commaRange,
88- tupleRange) -> Some( parameterName, paramRange, funcName, funcRange, Some appRange)
89- | SynExpr.Tuple ( isStruct, [ SynExpr.Const ( SynConst.String ( parameterName, paramRange), constRange); secondItem ], commaRange, tupleRange) ->
92+ | SynExpr.Tuple (_,
93+ [ SynExpr.Const ( SynConst.String ( parameterName, paramRange), _);
94+ Apply ( funcName, _, funcRange, appRange) ],
95+ _,
96+ _) -> Some( parameterName, paramRange, funcName, funcRange, Some appRange)
97+ | SynExpr.Tuple (_,
98+ [ SynExpr.Const ( SynConst.String ( parameterName, paramRange), constRange); secondItem ],
99+ _,
100+ _) ->
90101 match secondItem with
91- | SynExpr.LongIdent ( isOptional , longDotId, altName , identRange) ->
102+ | SynExpr.LongIdent (_ , longDotId, _ , identRange) ->
92103 match longDotId with
93- | LongIdentWithDots ( listOfIds, ranges ) ->
104+ | LongIdentWithDots ( listOfIds, _ ) ->
94105 let fullName =
95106 listOfIds
96107 |> List.map ( fun id -> id.idText)
97108 |> String.concat " ."
98109
99110 Some( parameterName, paramRange, fullName, identRange, None)
100111 | _ -> None
101- | SynExpr.Tuple ( isStruct , [ firstItem; secondItem ], commaRange , tupleRange ) ->
112+ | SynExpr.Tuple (_ , [ firstItem; secondItem ], _, _ ) ->
102113 printfn " Tuple: %A %A " firstItem secondItem
103114 None
104115 | x ->
@@ -108,25 +119,25 @@ module CosmosCodeAnalysis =
108119 let rec readParameters =
109120 function
110121 | ParameterTuple ( name, range, func, funcRange, appRange) -> [ name, range, func, funcRange, appRange ]
111- | SynExpr.Sequential ( debugSeqPoint , isTrueSeq , expr1, expr2, seqRange ) ->
122+ | SynExpr.Sequential (_, _ , expr1, expr2, _ ) ->
112123 [ yield ! readParameters expr1
113124 yield ! readParameters expr2 ]
114125 | _ -> []
115126
116127 let (| Parameters | _ |) =
117128 function
118- | Apply ( " Cosmos.parameters" , SynExpr.ArrayOrListOfSeqExpr ( isArray , listExpr, listRange ), funcRange , appRange ) ->
129+ | Apply ( " Cosmos.parameters" , SynExpr.ArrayOrListOfSeqExpr (_ , listExpr, _ ), _, _ ) ->
119130 match listExpr with
120- | SynExpr.CompExpr ( isArrayOfList , isNotNakedRefCell , compExpr, compRange) -> Some( readParameters compExpr, compRange)
131+ | SynExpr.CompExpr (_, _ , compExpr, compRange) -> Some( readParameters compExpr, compRange)
121132 | _ -> None
122133 | _ -> None
123134
124135 let rec findQuery =
125136 function
126137 | Query ( query, range) -> [ CosmosAnalyzerBlock.Query( query, range) ]
127138 | LiteralQuery ( identifier, range) -> [ CosmosAnalyzerBlock.LiteralQuery( identifier, range) ]
128- | TypedQuery ( typeNames , query, typeAppRange) -> [ CosmosAnalyzerBlock.Query( query, typeAppRange) ]
129- | SynExpr.App ( exprAtomic , isInfix , funcExpr, argExpr, range ) ->
139+ | TypedQuery (_ , query, typeAppRange) -> [ CosmosAnalyzerBlock.Query( query, typeAppRange) ]
140+ | SynExpr.App (_, _ , funcExpr, argExpr, _ ) ->
130141 [ yield ! findQuery funcExpr
131142 yield ! findQuery argExpr ]
132143 | _ -> []
@@ -135,7 +146,7 @@ module CosmosCodeAnalysis =
135146 function
136147 | Database ( query, range) -> [ CosmosAnalyzerBlock.DatabaseId( query, range) ]
137148 | LiteralQuery ( identifier, range) -> [ CosmosAnalyzerBlock.LiteralDatabaseId( identifier, range) ]
138- | SynExpr.App ( exprAtomic , isInfix , funcExpr, argExpr, range ) ->
149+ | SynExpr.App (_, _ , funcExpr, argExpr, _ ) ->
139150 [ yield ! findDatabase funcExpr
140151 yield ! findDatabase argExpr ]
141152 | _ -> []
@@ -144,7 +155,7 @@ module CosmosCodeAnalysis =
144155 function
145156 | Container ( query, range) -> [ CosmosAnalyzerBlock.ContainerName( query, range) ]
146157 | LiteralQuery ( identifier, range) -> [ CosmosAnalyzerBlock.LiteralContainerName( identifier, range) ]
147- | SynExpr.App ( exprAtomic , isInfix , funcExpr, argExpr, range ) ->
158+ | SynExpr.App (_, _ , funcExpr, argExpr, _ ) ->
148159 [ yield ! findContainerName funcExpr
149160 yield ! findContainerName argExpr ]
150161 | _ -> []
@@ -163,7 +174,7 @@ module CosmosCodeAnalysis =
163174
164175 [ CosmosAnalyzerBlock.Parameters( queryParams, range) ]
165176
166- | SynExpr.App ( exprAtomic , isInfix , funcExpr, argExpr, range ) ->
177+ | SynExpr.App (_, _ , funcExpr, argExpr, _ ) ->
167178 [ yield ! findParameters funcExpr
168179 yield ! findParameters argExpr ]
169180
@@ -173,9 +184,9 @@ module CosmosCodeAnalysis =
173184 // and then walk backwards from there to find the other parts that should exist
174185 let rec visitSyntacticExpression ( expr : SynExpr ) ( fullExpressionRange : range ) =
175186 match expr with
176- | SynExpr.App ( exprAtomic , isInfix , funcExpr, argExpr, range) ->
187+ | SynExpr.App (_, _ , funcExpr, argExpr, range) ->
177188 match argExpr with
178- | Apply (( " Cosmos.execAsync" ), lambdaExp , funcRange , appRange ) ->
189+ | Apply (( " Cosmos.execAsync" ), _, _, _ ) ->
179190 let blocks =
180191 [ yield ! findQuery funcExpr
181192 yield ! findDatabase funcExpr
@@ -205,7 +216,7 @@ module CosmosCodeAnalysis =
205216
206217 [ { blocks = blocks; range = range } ]
207218
208- | Parameters ( parameters, queryRange ) ->
219+ | Parameters ( parameters, _ ) ->
209220 let queryParams =
210221 parameters
211222 |> List.map ( fun ( name , range , func , funcRange , appRange ) ->
@@ -237,7 +248,7 @@ module CosmosCodeAnalysis =
237248
238249 [ { blocks = blocks; range = range } ]
239250
240- | Apply ( anyOtherFunc , funcArgs , range, appRange ) ->
251+ | Apply (_, _ , range, _ ) ->
241252 let blocks =
242253 [ yield ! findQuery funcExpr
243254 yield ! findDatabase funcExpr
@@ -248,7 +259,7 @@ module CosmosCodeAnalysis =
248259
249260 | _ -> []
250261
251- | SynExpr.LetOrUse ( isRecursive , isUse , bindings, body, range) ->
262+ | SynExpr.LetOrUse (_, _ , bindings, body, range) ->
252263 [ yield ! visitSyntacticExpression body range
253264 for binding in bindings do
254265 yield ! visitBinding binding ]
@@ -257,26 +268,25 @@ module CosmosCodeAnalysis =
257268
258269 and visitBinding ( binding : SynBinding ): CosmosOperation list =
259270 match binding with
260- | SynBinding.Binding ( access, kind, mustInline, isMutable, attrs, xmlDecl, valData, headPat, returnInfo, expr, range, seqPoint) ->
261- visitSyntacticExpression expr range
271+ | Binding (_, _, _, _, _, _, _, _, _, expr, range, _) -> visitSyntacticExpression expr range
262272
263273
264274 let findOperations ( ctx : Context ) =
265275 let operations = ResizeArray< CosmosOperation>()
266276 match ctx.ParseTree with
267277 | ParsedInput.ImplFile input ->
268278 match input with
269- | ParsedImplFileInput.ParsedImplFileInput ( fileName , isScript , qualifiedName , _, _, modules, _) ->
279+ | ParsedImplFileInput (_, _, _ , _, _, modules, _) ->
270280 for parsedModule in modules do
271281 match parsedModule with
272- | SynModuleOrNamespace ( identifier , isRecursive , kind , declarations, _, _, _, _) ->
282+ | SynModuleOrNamespace (_, _, _ , declarations, _, _, _, _) ->
273283 for declaration in declarations do
274284 match declaration with
275- | SynModuleDecl.Let ( isRecursiveDef , bindings, range ) ->
285+ | SynModuleDecl.Let (_ , bindings, _ ) ->
276286 for binding in bindings do
277287 operations.AddRange( visitBinding binding)
278288 | _ -> ()
279289
280- | ParsedInput.SigFile file -> ()
290+ | ParsedInput.SigFile _ -> ()
281291
282292 operations |> Seq.toList
0 commit comments