common-workflow-lab/wdl-cwl-translator

Try to centralize strings parsing in get_expr_string

kinow opened this issue · 1 comments

kinow commented

It could call the get_literal_value function, so the rest of the code can be centralized in the expr_string function.

See: #184 (comment)

kinow commented

Managed to debug the existing tests and compared the behaviour/output of get_expr_string, Expr.String.literal, and get_literal_value`.

Screenshot from 2022-03-25 23-58-44

When the parts of the String expr are not of a certain type, then literal returns None. The rest of the code tries to create a JS expression, i think, to get a string. get_literal_value will recursively iterate the literal and create a value (no guarantee it's a string).

In summary, we cannot really use the same function to simplify/centralize it here. Closing! 👍