Skip to content

Commit

Permalink
make sure tests/local/complex_class.py still verifies, switch back to…
Browse files Browse the repository at this point in the history
… complex_class = False by default
  • Loading branch information
edgarsvitolins committed May 11, 2024
1 parent af67cce commit c4d5b96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/nagini_translation/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def visit_ClassDef(self, node: ast.ClassDef) -> None:
# check if a class is complex (when it or one of its parents had a @Complex class decorator)
# complex class instance attributes are stored in __dict__
# ME: Set to true to make all classes complex by default and test if things still work.
cls.is_complex = True # self.is_complex_class(node)
cls.is_complex = self.is_complex_class(node)

for member in node.body:
member.is_complex = cls.is_complex
Expand Down
2 changes: 1 addition & 1 deletion src/nagini_translation/lib/program_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def __init__(self, name: str, superscope: PythonScope,
# defining an algebraic data type or one of its constructors.
# This flag is set transitively across subclasses.
# ME: Set to true to make all classes complex by default and test if things still work.
self.is_complex = True # False
self.is_complex = False
self.illegal_attribute_names = set()

@property
Expand Down
4 changes: 3 additions & 1 deletion src/nagini_translation/translators/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,9 @@ def translate_Attribute(self, node: ast.Attribute,
recv_getattr = self._get_function_call(recv_type, func_name, args, arg_types, node, ctx,
position)

ret = (stmt, recv_getattr)
# ret = (stmt, recv_getattr)
ret_stmt = []
ret_val = recv_getattr
else:
ret_stmt, ret_val = self.get_complex_attr(node,
self.translate_string(node.attr, None, ctx),
Expand Down

0 comments on commit c4d5b96

Please sign in to comment.