Skip to content

Commit df1178f

Browse files
committed
splitted idls + simple merging
1 parent 0167840 commit df1178f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

TS.fsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,15 @@ module InputIdlJson =
144144
type InputIdlJsonType = JsonProvider<"inputfiles/sample.webidl.json">
145145

146146
let inputIdl =
147-
File.ReadAllText(GlobalVars.inputFolder + @"/browser.webidl.json") |> InputIdlJsonType.Parse
147+
let jsons =
148+
DirectoryInfo(GlobalVars.inputFolder + @"/idls").GetFiles()
149+
|> Array.map (fun file -> file.FullName |> File.ReadAllText |> InputIdlJsonType.Parse)
150+
151+
let inline extractJsonArray f =
152+
jsons |> Array.collect f |> Array.map (fun item -> (^a: (member JsonValue: JsonValue) item)) |> JsonValue.Array;
153+
154+
let list = [| ("typedefs", extractJsonArray (fun json -> json.Typedefs)) |]
155+
InputIdlJsonType.Root(JsonValue.Record list)
148156

149157
let allTypedefsMap =
150158
inputIdl.Typedefs |> toNameMap

0 commit comments

Comments
 (0)