Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: back frame in abstracted operations as functions #62

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions nada_dsl/nada_types/scalar_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def equals_operation(
return Boolean(value=bool(f(left.value, right.value)))
case Mode.PUBLIC:
operation = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return PublicBoolean(child=operation)
case Mode.SECRET:
operation = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return SecretBoolean(child=operation)

Expand Down Expand Up @@ -227,7 +227,7 @@ def binary_arithmetic_operation(
return new_scalar_type(mode, base_type)(f(left.value, right.value))
case Mode.PUBLIC | Mode.SECRET:
child = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return new_scalar_type(mode, base_type)(child)

Expand All @@ -249,7 +249,7 @@ def shift_operation(
return new_scalar_type(mode, base_type)(f(left.value, right.value))
case Mode.PUBLIC | Mode.SECRET:
child = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return new_scalar_type(mode, base_type)(child)

Expand All @@ -267,7 +267,7 @@ def binary_relational_operation(
return new_scalar_type(mode, BaseType.BOOLEAN)(f(left.value, right.value)) # type: ignore
case Mode.PUBLIC | Mode.SECRET:
child = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return new_scalar_type(mode, BaseType.BOOLEAN)(child) # type: ignore

Expand All @@ -282,7 +282,7 @@ def public_equals_operation(left: ScalarType, right: ScalarType) -> "PublicBoole

return PublicBoolean(
child=PublicOutputEquality(
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
) # type: ignore
)

Expand Down Expand Up @@ -338,12 +338,12 @@ def binary_logical_operation(
return Boolean(value=bool(f(left.value, right.value)))
if mode == Mode.PUBLIC:
operation = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return PublicBoolean(child=operation)

operation = globals()[operation](
left=left, right=right, source_ref=SourceRef.back_frame()
left=left, right=right, source_ref=SourceRef.back_frame().back_frame()
)
return SecretBoolean(child=operation)

Expand Down