Skip to content

Commit

Permalink
Make AST node more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
jakelishman committed Jan 31, 2024
1 parent 41fdf36 commit 0891659
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions qiskit/qasm3/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,9 @@ class DefaultCase(Expression):
"""An object representing the `default` special label in switch statements."""


class SwitchStatementV1(Statement):
"""AST node for the proposed 'switch-case' extension to OpenQASM 3.
class SwitchStatementPreview(Statement):
"""AST node for the proposed 'switch-case' extension to OpenQASM 3, before the syntax was
stabilized. This corresponds to the :attr:`.ExperimentalFeatures.SWITCH_CASE_V1` logic.
The stabilized form of the syntax instead uses :class:`.SwitchStatement`."""

Expand Down
2 changes: 1 addition & 1 deletion qiskit/qasm3/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,7 +857,7 @@ def case(values, case_block):

return [
ast.AssignmentStatement(target, real_target),
ast.SwitchStatementV1(
ast.SwitchStatementPreview(
target,
(
case(values, block)
Expand Down
2 changes: 1 addition & 1 deletion qiskit/qasm3/printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _visit_SwitchStatement(self, node: ast.SwitchStatement) -> None:
self.stream.write("}")
self._end_line()

def _visit_SwitchStatementV1(self, node: ast.SwitchStatementV1) -> None:
def _visit_SwitchStatementPreview(self, node: ast.SwitchStatementPreview) -> None:
# This is the pre-release syntax, which had lots of extra `break` statements in it.
self._start_line()
self.stream.write("switch (")
Expand Down

0 comments on commit 0891659

Please sign in to comment.