Skip to content

Commit 4a784fd

Browse files
committed
splitted idls + simple merging
1 parent 88ca7ea commit 4a784fd

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
@@ -143,7 +143,15 @@ module InputIdlJson =
143143
type InputIdlJsonType = JsonProvider<"inputfiles/sample.webidl.json">
144144

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

148156
let allTypedefsMap =
149157
inputIdl.Typedefs |> toNameMap
File renamed without changes.

0 commit comments

Comments
 (0)