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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: codegen-2
3
- Version: 2.1.1
3
+ Version: 2.1.2
4
4
  Summary: Meta-programming
5
5
  License: MIT
6
6
  Author: Binh Vu
@@ -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)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "codegen-2"
3
- version = "2.1.1"
3
+ version = "2.1.2"
4
4
  description = "Meta-programming"
5
5
  authors = ["Binh Vu <binh@toan2.com>"]
6
6
  license = "MIT"
File without changes
File without changes
File without changes