Skip to content

Commit

Permalink
FIX: Try was broken
Browse files Browse the repository at this point in the history
  • Loading branch information
micoloth committed Mar 20, 2024
1 parent 07cc797 commit 9c62ff0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"color": "#ffffff",
"theme": "light"
},
"version": "0.4.0",
"version": "0.4.1",
"engines": {
"vscode": "^1.85.0"
},
Expand Down
9 changes: 8 additions & 1 deletion src/reactive_python_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,16 @@ def _visit_try(self, node: ast.Try): # ast.TryStar
all_vars_handlers = []
for handler in node.handlers:
scope = TempScopeVisitor(ExposedVariables(), is_lhs_target=self.is_lhs_target, is_also_input_of_aug_assign=self.is_also_input_of_aug_assign, _class=self._class)
visit_all(scope, handler.type, handler.name)
visit_all(scope, handler.type)

vars_stmts_handler = get_vars_for_nodes(scope, *handler.body, _class=self._class)
vars_handler = join_body_stmts_into_vars(*vars_stmts_handler, _class=self._class)

# Remove the handler.name from the input variables AND output variables, by hand:
vars_handler.input_variables -= set([handler.name])
vars_handler.output_variables -= set([handler.name])
vars_handler.inputs_variables_in_function_in_class -= set([handler.name])

all_vars_handlers.append(v_merge(scope.variables, vars_handler, _class=self._class)) # TO CHECK: Is this right?

self.variables = v_merge(self.variables, v_merge(vars_body, h_merge(*all_vars_handlers, vars_orelse), vars_finalbody, _class=self._class), _class=self._class)
Expand Down Expand Up @@ -2237,3 +2242,5 @@ def has_path(G, source, target):
return DiGraph, topological_sort, has_path

reactive_python_dag_builder_utils__ = ReactivePythonDagBuilderUtils__()


9 changes: 8 additions & 1 deletion src/reactive_python_engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,16 @@ class ReactivePythonDagBuilderUtils__():
all_vars_handlers = []
for handler in node.handlers:
scope = TempScopeVisitor(ExposedVariables(), is_lhs_target=self.is_lhs_target, is_also_input_of_aug_assign=self.is_also_input_of_aug_assign, _class=self._class)
visit_all(scope, handler.type, handler.name)
visit_all(scope, handler.type)
vars_stmts_handler = get_vars_for_nodes(scope, *handler.body, _class=self._class)
vars_handler = join_body_stmts_into_vars(*vars_stmts_handler, _class=self._class)
# Remove the handler.name from the input variables AND output variables, by hand:
vars_handler.input_variables -= set([handler.name])
vars_handler.output_variables -= set([handler.name])
vars_handler.inputs_variables_in_function_in_class -= set([handler.name])
all_vars_handlers.append(v_merge(scope.variables, vars_handler, _class=self._class)) # TO CHECK: Is this right?
self.variables = v_merge(self.variables, v_merge(vars_body, h_merge(*all_vars_handlers, vars_orelse), vars_finalbody, _class=self._class), _class=self._class)
Expand Down Expand Up @@ -2239,4 +2244,6 @@ class ReactivePythonDagBuilderUtils__():
reactive_python_dag_builder_utils__ = ReactivePythonDagBuilderUtils__()
`;

0 comments on commit 9c62ff0

Please sign in to comment.