fix handling of variables that don't match ts naming style

This commit is contained in:
Damien Elmes 2021-03-26 21:34:02 +10:00
parent c039845c16
commit 8920a6f9ea

View file

@ -62,10 +62,25 @@ def arg_kind(arg: Variable) -> str:
return "string"
def map_args_to_real_names(args: List[Variable]) -> str:
return ("{" + ", ".join(
[f'"{arg["name"]}": args.{typescript_arg_name(arg)}' for arg in args]
)
+ "}"
)
def get_args(args: List[Variable]) -> str:
if not args:
return ""
else:
for arg in args:
if typescript_arg_name(arg) != arg["name"]:
# we'll need to map variables to their fluent equiv
return ", " + map_args_to_real_names(args)
# variable names match, reference object instead
return ", args"