From 93470b50afb1dd4ac304bcaae6f9625970ef4cb7 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Sun, 14 May 2023 21:35:36 +0200 Subject: [PATCH] Fix syntax errors in generated typedef files --- packages/cli/src/gen/typedef_files.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/gen/typedef_files.rs b/packages/cli/src/gen/typedef_files.rs index 33453bf..12f847c 100644 --- a/packages/cli/src/gen/typedef_files.rs +++ b/packages/cli/src/gen/typedef_files.rs @@ -83,7 +83,12 @@ fn make_return_table_item(item: &DefinitionsItem) -> Result { .map(|arg| format!("{}: {}", arg.name.trim(), arg.typedef.trim())) .collect::>() .join(", "); - write!(contents, "function ({args})")?; + // HACK: We should probably handle vararg and generics properly but this works for now... + let args = args + .replace("_: ...any", "...: any") + .replace("_: T...", "...: any") + .replace("(T...)", "(...any)"); + write!(contents, "function({args})")?; write!(contents, "\n\treturn nil :: any")?; write!(contents, "\nend,")?; } else if item.is_property() {