codegen-2 2.1.1__tar.gz → 2.1.2__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.1.1 → codegen_2-2.1.2}/PKG-INFO +1 -1
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/ast.py +4 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/pyproject.toml +1 -1
- {codegen_2-2.1.1 → codegen_2-2.1.2}/LICENSE +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/README.md +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/__init__.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/__init__.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/expr.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/program.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/statement.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/types.py +0 -0
- {codegen_2-2.1.1 → codegen_2-2.1.2}/codegen/models/var.py +0 -0
|
@@ -15,6 +15,7 @@ from codegen.models.statement import (
|
|
|
15
15
|
IfStatement,
|
|
16
16
|
ImportStatement,
|
|
17
17
|
LineBreak,
|
|
18
|
+
NoStatement,
|
|
18
19
|
PythonStatement,
|
|
19
20
|
ReturnStatement,
|
|
20
21
|
SingleExprStatement,
|
|
@@ -176,6 +177,7 @@ class AST:
|
|
|
176
177
|
else:
|
|
177
178
|
for ast in self.children:
|
|
178
179
|
if ast.find_ast(id) is not None:
|
|
180
|
+
yield self
|
|
179
181
|
yield from ast.find_ast_to(id)
|
|
180
182
|
break
|
|
181
183
|
|
|
@@ -211,6 +213,8 @@ class AST:
|
|
|
211
213
|
return VarScope(self.id, len(self.children))
|
|
212
214
|
|
|
213
215
|
def _add_stmt(self, stmt: Statement):
|
|
216
|
+
if isinstance(stmt, NoStatement):
|
|
217
|
+
return self
|
|
214
218
|
if self._is_frozen:
|
|
215
219
|
raise Exception("The AST is frozen and cannot be modified")
|
|
216
220
|
ast = AST(self.next_child_id(), self.prog, stmt)
|
|
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
|