@@ -25,7 +25,7 @@ type NestedAttribute =
2525 member nf.Print () =
2626 match nf with
2727 | FParam i -> sprintf " <$param%d >" i
28- | FField f when not <| isValidFieldName f -> sprintf " map keys must be 1 to 64k long (as utf8)." |> invalidArg f
28+ | FField f when not <| isValidFieldName f -> invalidArg f " map keys must be 1 to 64k long (as utf8)."
2929 | FField f -> " ." + f
3030 | FIndex i -> sprintf " [%d ]" i
3131
@@ -56,43 +56,43 @@ type AttributeId =
5656
5757 member id.Tokens = seq {
5858 yield id.RootName
59- yield ! id.NestedAttributes |> Seq.map ( fun nf -> nf .Print() )
59+ yield ! id.NestedAttributes |> Seq.map _ . Print()
6060 }
6161
6262 member id.IsHashKey =
6363 List.isEmpty id.NestedAttributes
6464 && id.KeySchemata
6565 |> Array.exists ( function
66- | ( _, KeyType.Hash) -> true
66+ | _, KeyType.Hash -> true
6767 | _ -> false )
6868
6969 member id.IsRangeKey =
7070 List.isEmpty id.NestedAttributes
7171 && id.KeySchemata
7272 |> Array.exists ( function
73- | ( _, KeyType.Range) -> true
73+ | _, KeyType.Range -> true
7474 | _ -> false )
7575
7676 member id.IsPrimaryKey =
7777 List.isEmpty id.NestedAttributes
7878 && id.KeySchemata
7979 |> Array.exists ( function
80- | ( { Type = PrimaryKey }, _) -> true
80+ | { Type = PrimaryKey }, _ -> true
8181 | _ -> false )
8282
8383 member id.Append nf = { id with NestedAttributes = id.NestedAttributes @ [ nf ] }
8484 member id.Apply ( inputs : obj []) =
8585 let applyField nf =
8686 match nf with
8787 | FParam i ->
88- match inputs. [ i] with
88+ match inputs[ i] with
8989 | :? string as f -> FField f
9090 | :? int as i ->
9191 if i < 0 then
9292 raise <| ArgumentOutOfRangeException()
9393 else
9494 FIndex i
95- | _ -> raise <| new InvalidCastException()
95+ | _ -> raise <| InvalidCastException()
9696 | _ -> nf
9797
9898 { id with NestedAttributes = id.NestedAttributes |> List.map applyField }
@@ -107,7 +107,7 @@ type AttributeId =
107107
108108type PropertyMetadata with
109109
110- /// Gets an attribute Id for given record property that
110+ /// Gets an attribute id for given record property that
111111 /// is recognizable by DynamoDB
112112 member rp.AttrId = sprintf " #ATTR%d " rp.Index
113113
@@ -137,7 +137,7 @@ type QuotedAttribute =
137137
138138 aux ap
139139
140- /// Gets an attribute identifier for given Quoted attribute instace
140+ /// Gets an attribute identifier for given Quoted attribute instance
141141 member ap.Id =
142142 let rec getTokens acc ap =
143143 match ap with
@@ -250,30 +250,29 @@ type QuotedAttribute =
250250/// Wrapper API for writing attribute names and values for Dynamo query, update and condition expressions
251251/// Responsible for generating unique placeholders for attribute names and values
252252type AttributeWriter ( names : Dictionary < string , string >, values : Dictionary < string , AttributeValue >) =
253- static let cmp = new AttributeValueComparer()
254- let vcontents = new Dictionary< AttributeValue, string>( cmp)
253+ static let cmp = AttributeValueComparer()
254+ let ids = Dictionary< AttributeValue, string>( cmp)
255255
256256 new () = AttributeWriter( Dictionary(), Dictionary())
257257
258258 member _.Names = if names.Count = 0 then null else names
259259 member _.Values = if values.Count = 0 then null else values
260260
261261 member _.WriteValue ( av : AttributeValue ) =
262- let ok , found = vcontents.TryGetValue av
263- if ok then
264- found
265- else
262+ match ids.TryGetValue av with
263+ | true , id -> id
264+ | false , _ ->
266265 let id = sprintf " :val%d " values.Count
267- vcontents .Add( av, id)
266+ ids .Add( av, id)
268267 values.Add( id, av)
269268 id
270269 member _.WriteAttribute ( attr : AttributeId ) =
271270 names[ attr.RootId] <- attr.RootName
272271 attr.Id
273272
274- /// Recognizes exprs of shape <@ fun p1 p2 ... -> body @>
273+ /// Recognizes Expr values of shape <@ fun p1 p2 ... -> body @>
275274let extractExprParams ( recordInfo : RecordTableInfo ) ( expr : Expr ) =
276- let vars = new Dictionary< Var, int>()
275+ let vars = Dictionary< Var, int>()
277276 let rec aux i expr =
278277 match expr with
279278 | Lambda( v, body) when v.Type <> recordInfo.Type ->
@@ -297,26 +296,26 @@ let extractExprParams (recordInfo: RecordTableInfo) (expr: Expr) =
297296type private AttributeNode = { Value: string ; Children: ResizeArray < AttributeNode > }
298297/// Detects conflicts in a collection of attribute paths
299298let tryFindConflictingPaths ( attrs : seq < AttributeId >) =
300- let root = new ResizeArray< AttributeNode>()
299+ let root = ResizeArray< AttributeNode>()
301300 let tryAppendPath ( attr : AttributeId ) =
302301 let tokens = attr.Tokens
303302 let enum = tokens.GetEnumerator()
304303 let mutable ctx = root
305304 let mutable isNodeAdded = false
306305 let mutable isLeafFound = false
307- let acc = new ResizeArray<_>()
306+ let acc = ResizeArray<_>()
308307 while not isLeafFound && enum .MoveNext() do
309308 let t = enum .Current
310309 let child =
311310 match ctx.FindIndex( fun n -> n.Value = t) with
312311 | - 1 ->
313312 isNodeAdded <- true
314- let ch = { Value = t; Children = new ResizeArray<_>() }
313+ let ch = { Value = t; Children = ResizeArray<_>() }
315314 ctx.Add ch
316315 ch
317316
318317 | i ->
319- let ch = ctx. [ i]
318+ let ch = ctx[ i]
320319 if ch.Children.Count = 0 then
321320 isLeafFound <- true
322321 ch
@@ -329,7 +328,7 @@ let tryFindConflictingPaths (attrs: seq<AttributeId>) =
329328 Some( concat tokens, concat acc)
330329 elif not isNodeAdded then
331330 while ctx.Count > 0 do
332- let ch = ctx. [0 ]
331+ let ch = ctx[ 0 ]
333332 acc.Add ch.Value
334333 ctx <- ch.Children
335334
0 commit comments