codegen-2 2.15.1__tar.gz → 2.15.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codegen_2-2.15.1 → codegen_2-2.15.3}/PKG-INFO +1 -1
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/statement.py +8 -2
- {codegen_2-2.15.1 → codegen_2-2.15.3}/pyproject.toml +1 -1
- {codegen_2-2.15.1 → codegen_2-2.15.3}/LICENSE +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/README.md +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/__init__.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/__init__.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/ast.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/expr.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/program.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/types.py +0 -0
- {codegen_2-2.15.1 → codegen_2-2.15.3}/codegen/models/var.py +0 -0
|
@@ -96,7 +96,7 @@ class DefFuncStatement(Statement):
|
|
|
96
96
|
comment: str = ""
|
|
97
97
|
|
|
98
98
|
def to_python(self):
|
|
99
|
-
sig = f"def {self.name}({', '.join([arg[0].to_python() +
|
|
99
|
+
sig = f"def {self.name}({', '.join([arg[0].to_python() + ' = ' + arg[1].to_python() if isinstance(arg, tuple) else arg.to_python() for arg in self.args])})"
|
|
100
100
|
if self.return_type is not None:
|
|
101
101
|
sig += f" -> {self.return_type.to_python()}"
|
|
102
102
|
if self.is_async:
|
|
@@ -130,7 +130,7 @@ class DefFuncStatement(Statement):
|
|
|
130
130
|
|
|
131
131
|
sig = (
|
|
132
132
|
keyword
|
|
133
|
-
+ f"{self.name}({', '.join([arg[0].to_typescript() +
|
|
133
|
+
+ f"{self.name}({', '.join([arg[0].to_typescript() + ' = ' + arg[1].to_typescript() if isinstance(arg, tuple) else arg.to_typescript() for arg in self.args])})"
|
|
134
134
|
)
|
|
135
135
|
if self.return_type is not None:
|
|
136
136
|
sig += f": {self.return_type.to_typescript()}"
|
|
@@ -342,6 +342,9 @@ class IfStatement(Statement):
|
|
|
342
342
|
def to_python(self):
|
|
343
343
|
return f"if {self.cond.to_python()}:"
|
|
344
344
|
|
|
345
|
+
def to_typescript(self):
|
|
346
|
+
return f"if ({self.cond.to_typescript()})"
|
|
347
|
+
|
|
345
348
|
|
|
346
349
|
@dataclass
|
|
347
350
|
class TryStatement(Statement):
|
|
@@ -364,6 +367,9 @@ class ElseStatement(Statement):
|
|
|
364
367
|
def to_python(self):
|
|
365
368
|
return "else:"
|
|
366
369
|
|
|
370
|
+
def to_typescript(self):
|
|
371
|
+
return "else"
|
|
372
|
+
|
|
367
373
|
|
|
368
374
|
@dataclass
|
|
369
375
|
class Comment(Statement):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|