Skip to content

Commit

Permalink
Refactor irast Call to use a dictionary of arguments (#7159)
Browse files Browse the repository at this point in the history
Named arguments are now indexed by name, and positional arguments are now indexed by position index.

Previously, arguments were stored as a list, with the named parameters coming first, sorted alphabetically.

---------

Co-authored-by: Aljaž Mur Eržen <[email protected]>
  • Loading branch information
dnwpark and aljazerzen authored Apr 11, 2024
1 parent 411d23f commit 996a1f9
Show file tree
Hide file tree
Showing 18 changed files with 213 additions and 568 deletions.
206 changes: 0 additions & 206 deletions edb/common/ast/match.py

This file was deleted.

18 changes: 9 additions & 9 deletions edb/edgeql/compiler/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,10 @@ def _compile_dml_coalesce(
# Note that lhs_ir will be unfenced while rhs_ir
# will have been compiled under fences.
match ir.expr:
case irast.OperatorCall(args=[
irast.CallArg(expr=lhs_ir),
irast.CallArg(expr=rhs_ir),
]):
case irast.OperatorCall(args={
0: irast.CallArg(expr=lhs_ir),
1: irast.CallArg(expr=rhs_ir),
}):
pass
case _:
raise AssertionError('malformed DML ??')
Expand Down Expand Up @@ -450,11 +450,11 @@ def _compile_dml_ifelse(
# Note that cond_ir will be unfenced while if_ir and else_ir
# will have been compiled under fences.
match ir.expr:
case irast.OperatorCall(args=[
irast.CallArg(expr=if_ir),
irast.CallArg(expr=cond_ir),
irast.CallArg(expr=else_ir),
]):
case irast.OperatorCall(args={
0: irast.CallArg(expr=if_ir),
1: irast.CallArg(expr=cond_ir),
2: irast.CallArg(expr=else_ir),
}):
pass
case _:
raise AssertionError('malformed DML IF/ELSE')
Expand Down
Loading

0 comments on commit 996a1f9

Please sign in to comment.