metapensiero / metapensiero.pj

Javascript for refined palates: a Python 3 to ES6 Javascript translator
Other
901 stars 73 forks source link

Node type 'NamedExpr': No transformation for the node #83

Open markb-trustifi opened 2 months ago

markb-trustifi commented 2 months ago

I have such python code:

if (info := _getMsgClassInfo(classType))[0]:
   if info[1]:
      raise UnsupportedMSGTypeError(f'Support for MSG type "{ct}" has been refused. See {constants.REPOSITORY_URL}/issues/{info[1]} for more information.')
   raise UnsupportedMSGTypeError(f'MSG type "{ct}" currently is not supported by the module. If you would like support, please make a feature request.')

Where _getMsgClassInfo is some class. When I translate it with PJ I get this error: TransformationError: Node type 'NamedExpr': Line: 173, column: 12. No transformation for the node When I replace ":=" with "=", I get this error: SyntaxError: invalid syntax. Maybe you meant '==' or ':=' instead of '='? (<unknown>, line 173)

azazel75 commented 2 months ago

The first error is because the walrus operator isn't supported yet, the second is because it's just invalid in plain Python