Skip to content

Commit eec93ee

Browse files
committed
Process duration ast first
1 parent b616186 commit eec93ee

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

oqpy/program.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ def delay(
348348
qubits_or_frames: AstConvertible | Iterable[AstConvertible] | None = None,
349349
) -> Program:
350350
"""Apply a delay to a set of qubits or frames."""
351+
ast_duration = to_ast(self, make_duration(time))
352+
351353
if qubits_or_frames is None:
352354
ast_qubits_or_frames = []
353355
else:
@@ -358,7 +360,6 @@ def delay(
358360
if len(qubits_or_frames) == 0:
359361
return self
360362
ast_qubits_or_frames = map_to_ast(self, qubits_or_frames)
361-
ast_duration = to_ast(self, make_duration(time))
362363
self._add_statement(ast.DelayInstruction(ast_duration, ast_qubits_or_frames))
363364
return self
364365

tests/test_directives.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ def _to_oqpy_expression(self):
970970
"""
971971
OPENQASM 3.0;
972972
duration a1 = 100.0ns;
973-
frame f1;
974973
duration a2 = 100.0ns;
974+
frame f1;
975975
a1 = 2;
976976
delay[a2] f1;
977977
"""

0 commit comments

Comments
 (0)