diff --git a/qiskit/qasm3/ast.py b/qiskit/qasm3/ast.py index 97d285df6e68..9b8271ce7fb7 100644 --- a/qiskit/qasm3/ast.py +++ b/qiskit/qasm3/ast.py @@ -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`.""" diff --git a/qiskit/qasm3/exporter.py b/qiskit/qasm3/exporter.py index 9ab35a97a8d5..7ae0c321551f 100644 --- a/qiskit/qasm3/exporter.py +++ b/qiskit/qasm3/exporter.py @@ -857,7 +857,7 @@ def case(values, case_block): return [ ast.AssignmentStatement(target, real_target), - ast.SwitchStatementV1( + ast.SwitchStatementPreview( target, ( case(values, block) diff --git a/qiskit/qasm3/printer.py b/qiskit/qasm3/printer.py index bdf1915f1c1a..94d12a7ecff6 100644 --- a/qiskit/qasm3/printer.py +++ b/qiskit/qasm3/printer.py @@ -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 (")