@@ -328,6 +328,7 @@ pub struct ClassicalDeclarationStmt {
328
328
pub span : Span ,
329
329
pub ty_span : Span ,
330
330
pub symbol_id : SymbolId ,
331
+ pub ty_exprs : List < Expr > ,
331
332
pub init_expr : Box < Expr > ,
332
333
}
333
334
@@ -336,6 +337,7 @@ impl Display for ClassicalDeclarationStmt {
336
337
writeln_header ( f, "ClassicalDeclarationStmt" , self . span ) ?;
337
338
writeln_field ( f, "symbol_id" , & self . symbol_id ) ?;
338
339
writeln_field ( f, "ty_span" , & self . ty_span ) ?;
340
+ writeln_list_field ( f, "ty_exprs" , & self . ty_exprs ) ?;
339
341
write_field ( f, "init_expr" , self . init_expr . as_ref ( ) )
340
342
}
341
343
}
@@ -351,14 +353,30 @@ impl Display for ContinueStmt {
351
353
}
352
354
}
353
355
356
+ #[ derive( Clone , Debug ) ]
357
+ pub struct DefParameter {
358
+ pub span : Span ,
359
+ pub symbol_id : SymbolId ,
360
+ pub ty_exprs : List < Expr > ,
361
+ }
362
+
363
+ impl Display for DefParameter {
364
+ fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
365
+ writeln_header ( f, "DefParameter" , self . span ) ?;
366
+ writeln_field ( f, "symbol_id" , & self . symbol_id ) ?;
367
+ write_list_field ( f, "ty_exprs" , & self . ty_exprs )
368
+ }
369
+ }
370
+
354
371
#[ derive( Clone , Debug ) ]
355
372
pub struct DefStmt {
356
373
pub span : Span ,
357
374
pub symbol_id : SymbolId ,
358
375
pub has_qubit_params : bool ,
359
- pub params : Box < [ SymbolId ] > ,
376
+ pub params : List < DefParameter > ,
360
377
pub body : Block ,
361
378
pub return_type_span : Span ,
379
+ pub return_ty_exprs : List < Expr > ,
362
380
}
363
381
364
382
impl Display for DefStmt {
@@ -368,6 +386,7 @@ impl Display for DefStmt {
368
386
writeln_field ( f, "has_qubit_params" , & self . has_qubit_params ) ?;
369
387
writeln_list_field ( f, "parameters" , & self . params ) ?;
370
388
writeln_field ( f, "return_type_span" , & self . return_type_span ) ?;
389
+ writeln_list_field ( f, "return_ty_exprs" , & self . return_ty_exprs ) ?;
371
390
write_field ( f, "body" , & self . body )
372
391
}
373
392
}
@@ -428,19 +447,24 @@ impl Display for ExprStmt {
428
447
pub struct ExternDecl {
429
448
pub span : Span ,
430
449
pub symbol_id : SymbolId ,
450
+ pub ty_exprs : List < Expr > ,
451
+ pub return_ty_exprs : List < Expr > ,
431
452
}
432
453
433
454
impl Display for ExternDecl {
434
455
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
435
456
writeln_header ( f, "ExternDecl" , self . span ) ?;
436
- write_field ( f, "symbol_id" , & self . symbol_id )
457
+ writeln_field ( f, "symbol_id" , & self . symbol_id ) ?;
458
+ writeln_list_field ( f, "ty_exprs" , & self . ty_exprs ) ?;
459
+ write_list_field ( f, "return_ty_exprs" , & self . return_ty_exprs )
437
460
}
438
461
}
439
462
440
463
#[ derive( Clone , Debug ) ]
441
464
pub struct ForStmt {
442
465
pub span : Span ,
443
466
pub loop_variable : SymbolId ,
467
+ pub ty_exprs : List < Expr > ,
444
468
pub set_declaration : Box < EnumerableSet > ,
445
469
pub body : Stmt ,
446
470
}
@@ -449,6 +473,7 @@ impl Display for ForStmt {
449
473
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
450
474
writeln_header ( f, "ForStmt" , self . span ) ?;
451
475
writeln_field ( f, "loop_variable" , & self . loop_variable ) ?;
476
+ writeln_list_field ( f, "ty_exprs" , & self . ty_exprs ) ?;
452
477
writeln_field ( f, "iterable" , & self . set_declaration ) ?;
453
478
write_field ( f, "body" , & self . body )
454
479
}
@@ -534,19 +559,22 @@ pub struct InputDeclaration {
534
559
// We don't have a type span here, because input decls are in
535
560
// the symbol table which tracks the ty span separately.
536
561
pub symbol_id : SymbolId ,
562
+ pub ty_exprs : List < Expr > ,
537
563
}
538
564
539
565
impl Display for InputDeclaration {
540
566
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
541
567
writeln_header ( f, "InputDeclaration" , self . span ) ?;
542
- write_field ( f, "symbol_id" , & self . symbol_id )
568
+ writeln_field ( f, "symbol_id" , & self . symbol_id ) ?;
569
+ write_list_field ( f, "ty_exprs" , & self . ty_exprs )
543
570
}
544
571
}
545
572
546
573
#[ derive( Clone , Debug ) ]
547
574
pub struct OutputDeclaration {
548
575
pub span : Span ,
549
576
pub ty_span : Span ,
577
+ pub ty_exprs : List < Expr > ,
550
578
pub symbol_id : SymbolId ,
551
579
pub init_expr : Box < Expr > ,
552
580
}
@@ -555,6 +583,7 @@ impl Display for OutputDeclaration {
555
583
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
556
584
writeln_header ( f, "OutputDeclaration" , self . span ) ?;
557
585
writeln_field ( f, "symbol_id" , & self . symbol_id ) ?;
586
+ writeln_list_field ( f, "ty_exprs" , & self . ty_exprs ) ?;
558
587
writeln_field ( f, "ty_span" , & self . ty_span ) ?;
559
588
write_field ( f, "init_expr" , & self . init_expr )
560
589
}
@@ -1194,6 +1223,7 @@ impl Display for CastKind {
1194
1223
pub struct Cast {
1195
1224
pub span : Span ,
1196
1225
pub ty : Type ,
1226
+ pub ty_exprs : List < Expr > ,
1197
1227
pub expr : Expr ,
1198
1228
pub kind : CastKind ,
1199
1229
}
@@ -1202,6 +1232,7 @@ impl Display for Cast {
1202
1232
fn fmt ( & self , f : & mut Formatter < ' _ > ) -> fmt:: Result {
1203
1233
writeln_header ( f, "Cast" , self . span ) ?;
1204
1234
writeln_field ( f, "ty" , & self . ty ) ?;
1235
+ writeln_list_field ( f, "ty_exprs" , & self . ty_exprs ) ?;
1205
1236
writeln_field ( f, "expr" , & self . expr ) ?;
1206
1237
write_field ( f, "kind" , & self . kind )
1207
1238
}
0 commit comments