Skip to content

Commit

Permalink
Add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz committed Dec 3, 2017
1 parent bf3cbe2 commit b3175c7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion TS.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ module InputIdlJson =
let hasType itemName =
allTypedefsMap.ContainsKey itemName

// Converts new JSON types to existing matching XML types
// to reduce code duplication before removing XML support
module Compat =
let xNamespace = XNamespace.Get "http://schemas.microsoft.com/ie/webidl-xml"

Expand Down Expand Up @@ -1508,15 +1510,19 @@ module Emit =
let emitTypeDefFromJson (typeDef: InputJsonType.Root) =
Pt.Printl "type %s = %s;" typeDef.Name.Value typeDef.Type.Value

// Load typedefs from XML input
let mutable map = browser.Typedefs |> Array.map(fun i -> (i.NewType, i)) |> Map.ofArray
// Load and merge typedefs from new JSON input
InputIdlJson.inputIdl.Typedefs
|> Array.iter (InputIdlJson.Compat.convertTypedef >> (fun i -> map <- map.Add(i.NewType, i)))


// Filter by removedType.json + knownWorkerInterfaces.json
map |> Map.toArray |> Array.map snd
|> Array.filter (fun typedef -> getRemovedItemByName typedef.NewType ItemKind.TypeDef "" |> Option.isNone)
|> Array.filter (fun i -> (flavor <> Flavor.Worker || knownWorkerInterfaces.Contains i.NewType))
|> Array.iter emitTypeDef

// Load manual additions from addedType.json
InputJson.getAddedItems ItemKind.TypeDef flavor
|> Array.iter emitTypeDefFromJson

Expand Down

0 comments on commit b3175c7

Please sign in to comment.