Fix stub addition to type block

This commit is contained in:
Ganesh Viswanathan 2019-12-20 16:25:56 -06:00
commit 90e81aa472

View file

@ -222,9 +222,11 @@ proc main(
# Include in wrapper file
data = outputFile.readFile()
if "type\n" in data:
# In existing type block
data = data.replace("type\n", "type\n" & stubData)
let
idx = data.find("\ntype\n")
if idx != -1:
# In first existing type block
data = data[0 ..< idx+6] & stubData & data[idx+6 .. ^1]
else:
# At the top if none already
data = "type\n" & stubData & data