Skip to content

Commit

Permalink
Fixed some issues with tests
Browse files Browse the repository at this point in the history
  • Loading branch information
titomeister committed Mar 29, 2024
1 parent ea97456 commit 632f252
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions skema/program_analysis/CAST2FN/ann_cast/to_gromet_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ def build_function_arguments_table(self, nodes):
self.function_arguments[node.name.name] = {}
for i, arg in enumerate(node.func_args, 1):
self.function_arguments[node.name.name][arg.val.name] = i
self.symbol_table["functions"][node.name.name] = (node.name.name, -1)
self.symbol_table["functions"][node.name.name] = (node.name.name, -1, [-1] * len(node.func_args))

def wire_from_var_env(self, name, gromet_fn):
var_environment = self.symtab_variables()
Expand Down Expand Up @@ -2699,11 +2699,15 @@ def visit_call(
# is not inlined or part of an assignment we don't visit the
# arguments as that's already been handled by the primitive handler
# if not is_primitive(func_name, "CAST") or (from_assignment or is_inline(func_name)):
print(func_name)
print(self.symtab_functions().keys())
if func_name in self.symtab_functions().keys():
print(self.symtab_functions()[func_name])
keyword_arg_len = len(self.symtab_functions()[func_name][2])
else:
keyword_arg_len = 0
visited_args = 0
print(keyword_arg_len)
for arg in node.arguments:
self.visit(arg, parent_gromet_fn, node)
visited_args += 1
Expand Down Expand Up @@ -2789,10 +2793,16 @@ def visit_call(
# order than they show up
# i.e. foo(y=1,x=2) when the definition is foo(x,y)
pif_offset = self.offset_pif(arg.left.val.name, func_name)
parent_gromet_fn.wff = insert_gromet_object(
parent_gromet_fn.wff,
GrometWire(src=pif_idx - (visited_args - pif_offset), tgt=len(parent_gromet_fn.pof))
)
if keyword_arg_len > 0:
parent_gromet_fn.wff = insert_gromet_object(
parent_gromet_fn.wff,
GrometWire(src=pif_idx - (visited_args - pif_offset), tgt=len(parent_gromet_fn.pof))
)
else:
parent_gromet_fn.wff = insert_gromet_object(
parent_gromet_fn.wff,
GrometWire(src=pif_idx, tgt=len(parent_gromet_fn.pof))
)
# if isinstance(arg.right)

# the number of visited args matches the number of keyword args
Expand Down

0 comments on commit 632f252

Please sign in to comment.