1515)
1616from .analysis import MeasureIDFrame , MeasurementIDAnalysis
1717
18- ## Can't do wire right now because of
19- ## unresolved RFC on return type
20- # from bloqade.squin import wire
21-
2218
2319@qubit .dialect .register (key = "measure_id" )
2420class SquinQubit (interp .MethodTable ):
@@ -32,7 +28,6 @@ def measure_qubit_list(
3228 ):
3329
3430 # try to get the length of the list
35- ## "...safely assume the type inference will give you what you need"
3631 qubits_type = stmt .qubits .type
3732 # vars[0] is just the type of the elements in the ilist,
3833 # vars[1] can contain a literal with length information
@@ -57,15 +52,12 @@ def measurement_predicate(
5752 stmt : qubit .stmts .IsLost | qubit .stmts .IsOne | qubit .stmts .IsZero ,
5853 ):
5954 original_measure_id_tuple = frame .get (stmt .measurements )
60- # all members should be RawMeasureId, if it's anything else
61- # it's Invalid.
6255 if not all (
6356 isinstance (measure_id , RawMeasureId )
6457 for measure_id in original_measure_id_tuple .data
6558 ):
6659 return (InvalidMeasureId (),)
6760
68- # get the proper predicate type
6961 if isinstance (stmt , qubit .stmts .IsLost ):
7062 predicate = Predicate .IS_LOST
7163 elif isinstance (stmt , qubit .stmts .IsOne ):
@@ -75,7 +67,6 @@ def measurement_predicate(
7567 else :
7668 return (InvalidMeasureId (),)
7769
78- # Create new MeasureIdBools with proper predicate type
7970 predicate_measure_ids = [
8071 MeasureIdBool (measure_id .idx , predicate )
8172 for measure_id in original_measure_id_tuple .data
@@ -131,14 +122,10 @@ def getitem(
131122 self , interp : MeasurementIDAnalysis , frame : interp .Frame , stmt : py .GetItem
132123 ):
133124
134- idx_or_slice = interp .get_const_value ( (int , slice ), stmt . index )
125+ idx_or_slice = interp .maybe_const ( stmt . index , (int , slice ))
135126 if idx_or_slice is None :
136127 return (InvalidMeasureId (),)
137128
138- # hint = stmt.index.hints.get("const")
139- # if hint is None or not isinstance(hint, const.Value):
140- # return (InvalidMeasureId(),)
141-
142129 obj = frame .get (stmt .obj )
143130 if isinstance (obj , MeasureIdTuple ):
144131 if isinstance (idx_or_slice , slice ):
0 commit comments