mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fix handling of variables that don't match ts naming style
This commit is contained in:
parent
c039845c16
commit
8920a6f9ea
1 changed files with 15 additions and 0 deletions
|
@ -62,10 +62,25 @@ def arg_kind(arg: Variable) -> str:
|
||||||
return "string"
|
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:
|
def get_args(args: List[Variable]) -> str:
|
||||||
if not args:
|
if not args:
|
||||||
return ""
|
return ""
|
||||||
else:
|
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"
|
return ", args"
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue