@@ -13,7 +13,7 @@ open Microsoft.FSharp.Reflection
13
13
module GlobalVars =
14
14
if not ( Directory.Exists(__ SOURCE_ DIRECTORY__ + @" \generated" )) then
15
15
Directory.CreateDirectory(__ SOURCE_ DIRECTORY__ + @" \generated" ) |> ignore
16
-
16
+
17
17
let inputFolder = __ SOURCE_ DIRECTORY__ + @" \inputfiles"
18
18
let makeTextWriter fileName = File.CreateText(__ SOURCE_ DIRECTORY__ + @" \generated\" + fileName) :> TextWriter
19
19
let jsWebOutput = makeTextWriter " domWeb.js"
@@ -102,7 +102,7 @@ type Printer(target : TextWriter) =
102
102
member this.endBrace () =
103
103
this.decreaseIndent()
104
104
this.printl " }"
105
-
105
+
106
106
member this.resetIndent () = curTabCount <- 0
107
107
member this.printWithAddedIndent content =
108
108
Printf.kprintf ( fun s -> output.Append( " \r\n " + this.getCurIndent() + " " + s) |> ignore) content
@@ -169,6 +169,15 @@ type DumpScope =
169
169
| InstanceOnly
170
170
| All
171
171
172
+ // Used to decide if a member should be emitted given its static property and
173
+ // the intended scope level.
174
+ let inline matchScope scope ( x : ^a when ^a : ( member Static : Option<int> )) =
175
+ if scope = DumpScope.All then true
176
+ else
177
+ let isStatic = ( ^a : ( member Static : Option< int>) x)
178
+ if isStatic.IsSome then scope = DumpScope.StaticOnly
179
+ else scope = DumpScope.InstanceOnly
180
+
172
181
/// ===========================================
173
182
/// Shared data and helper functions
174
183
/// ===========================================
@@ -190,8 +199,7 @@ let AdjustParamName name =
190
199
| _ -> name
191
200
192
201
/// Quick checker for option type values
193
- let OptionCheckValue value =
194
- function
202
+ let OptionCheckValue value = function
195
203
| Some v when v = value -> true
196
204
| _ -> false
197
205
@@ -228,9 +236,7 @@ let inline ShouldKeep flavor (i : ^a when ^a : (member Tags : string option) and
228
236
let allWebNonCallbackInterfaces = Array.concat [| browser.Interfaces; browser.MixinInterfaces.Interfaces |]
229
237
230
238
let allWebInterfaces =
231
- Array.concat [| browser.Interfaces
232
- [| browser.CallbackInterfaces.Interface |]
233
- browser.MixinInterfaces.Interfaces |]
239
+ Array.concat [| browser.Interfaces; [| browser.CallbackInterfaces.Interface |]; browser.MixinInterfaces.Interfaces |]
234
240
235
241
let allWorkerAdditionalInterfaces = Array.concat [| worker.Interfaces; worker.MixinInterfaces.Interfaces |]
236
242
let allInterfaces = Array.concat [| allWebInterfaces; allWorkerAdditionalInterfaces |]
@@ -555,3 +561,14 @@ let workerEventsMap =
555
561
( " loadend" , " ProgressEvent" )
556
562
( " progress" , " ProgressEvent" ) ]
557
563
|> Map.ofList
564
+
565
+ module Option =
566
+ let runIfSome f x =
567
+ match x with
568
+ | Some x' -> f x'
569
+ | _ -> ()
570
+
571
+ let toBool f x =
572
+ match x with
573
+ | Some x' -> f x'
574
+ | _ -> false
0 commit comments