@@ -5,14 +5,12 @@ use std::rc::Rc;
5
5
6
6
use num_bigint:: BigInt ;
7
7
8
- use qsc:: {
9
- ast:: {
10
- self , Attr , Block , CallableBody , CallableDecl , CallableKind , Expr , ExprKind , Ident , Item ,
11
- Lit , Mutability , NodeId , Pat , PatKind , Path , PathKind , QubitInit , QubitInitKind ,
12
- QubitSource , Stmt , StmtKind , TopLevelNode , Ty , TyKind ,
13
- } ,
14
- Span ,
8
+ use qsc_ast:: ast:: {
9
+ self , Attr , Block , CallableBody , CallableDecl , CallableKind , Expr , ExprKind , Ident , Item , Lit ,
10
+ Mutability , NodeId , Pat , PatKind , Path , PathKind , QubitInit , QubitInitKind , QubitSource , Stmt ,
11
+ StmtKind , TopLevelNode , Ty , TyKind ,
15
12
} ;
13
+ use qsc_data_structures:: span:: Span ;
16
14
17
15
use crate :: {
18
16
runtime:: RuntimeFunctions ,
@@ -203,7 +201,7 @@ where
203
201
}
204
202
}
205
203
206
- pub ( crate ) fn build_lit_result_expr ( value : qsc :: ast:: Result , span : Span ) -> Expr {
204
+ pub ( crate ) fn build_lit_result_expr ( value : qsc_ast :: ast:: Result , span : Span ) -> Expr {
207
205
Expr {
208
206
id : NodeId :: default ( ) ,
209
207
span,
@@ -231,15 +229,15 @@ pub(crate) fn build_lit_result_array_expr_from_bitstring<S: AsRef<str>>(
231
229
build_lit_result_array_expr ( values, span)
232
230
}
233
231
234
- pub ( crate ) fn build_lit_result_array_expr ( values : Vec < qsc :: ast:: Result > , span : Span ) -> Expr {
232
+ pub ( crate ) fn build_lit_result_array_expr ( values : Vec < qsc_ast :: ast:: Result > , span : Span ) -> Expr {
235
233
let exprs: Vec < _ > = values
236
234
. into_iter ( )
237
235
. map ( |v| build_lit_result_expr ( v, Span :: default ( ) ) )
238
236
. collect ( ) ;
239
237
build_expr_array_expr ( exprs, span)
240
238
}
241
239
242
- pub ( crate ) fn build_expr_array_expr ( values : Vec < qsc :: ast:: Expr > , span : Span ) -> Expr {
240
+ pub ( crate ) fn build_expr_array_expr ( values : Vec < qsc_ast :: ast:: Expr > , span : Span ) -> Expr {
243
241
let exprs: Vec < _ > = values. into_iter ( ) . map ( Box :: new) . collect ( ) ;
244
242
Expr {
245
243
id : NodeId :: default ( ) ,
@@ -314,7 +312,7 @@ pub(crate) fn build_binary_expr(
314
312
}
315
313
}
316
314
317
- pub ( crate ) fn is_complex_binop_supported ( op : qsc :: ast:: BinOp ) -> bool {
315
+ pub ( crate ) fn is_complex_binop_supported ( op : qsc_ast :: ast:: BinOp ) -> bool {
318
316
matches ! (
319
317
op,
320
318
ast:: BinOp :: Add | ast:: BinOp :: Sub | ast:: BinOp :: Mul | ast:: BinOp :: Div | ast:: BinOp :: Exp
@@ -1005,7 +1003,7 @@ pub(crate) fn build_top_level_ns_with_item<S: AsRef<str>>(
1005
1003
ns : S ,
1006
1004
entry : ast:: Item ,
1007
1005
) -> TopLevelNode {
1008
- TopLevelNode :: Namespace ( qsc :: ast:: Namespace {
1006
+ TopLevelNode :: Namespace ( qsc_ast :: ast:: Namespace {
1009
1007
id : NodeId :: default ( ) ,
1010
1008
span : whole_span,
1011
1009
name : [ Ident {
@@ -1031,10 +1029,10 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
1031
1029
// as an entry point. We will get a Q# compilation error if we
1032
1030
// attribute an operation with EntryPoint and it has input parameters.
1033
1031
if input_pats. is_empty ( ) {
1034
- attrs. push ( Box :: new ( qsc :: ast:: Attr {
1032
+ attrs. push ( Box :: new ( qsc_ast :: ast:: Attr {
1035
1033
id : NodeId :: default ( ) ,
1036
1034
span : Span :: default ( ) ,
1037
- name : Box :: new ( qsc :: ast:: Ident {
1035
+ name : Box :: new ( qsc_ast :: ast:: Ident {
1038
1036
name : Rc :: from ( "EntryPoint" ) ,
1039
1037
..Default :: default ( )
1040
1038
} ) ,
@@ -1044,15 +1042,15 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
1044
1042
let input_pats = input_pats. into_iter ( ) . map ( Box :: new) . collect :: < Vec < _ > > ( ) ;
1045
1043
let input = match input_pats. len ( ) {
1046
1044
0 => Box :: new ( Pat {
1047
- kind : Box :: new ( qsc :: ast:: PatKind :: Tuple ( input_pats. into_boxed_slice ( ) ) ) ,
1045
+ kind : Box :: new ( qsc_ast :: ast:: PatKind :: Tuple ( input_pats. into_boxed_slice ( ) ) ) ,
1048
1046
..Default :: default ( )
1049
1047
} ) ,
1050
1048
1 => Box :: new ( Pat {
1051
- kind : Box :: new ( qsc :: ast:: PatKind :: Paren ( input_pats[ 0 ] . clone ( ) ) ) ,
1049
+ kind : Box :: new ( qsc_ast :: ast:: PatKind :: Paren ( input_pats[ 0 ] . clone ( ) ) ) ,
1052
1050
..Default :: default ( )
1053
1051
} ) ,
1054
- _ => Box :: new ( qsc :: ast:: Pat {
1055
- kind : Box :: new ( qsc :: ast:: PatKind :: Tuple ( input_pats. into_boxed_slice ( ) ) ) ,
1052
+ _ => Box :: new ( qsc_ast :: ast:: Pat {
1053
+ kind : Box :: new ( qsc_ast :: ast:: PatKind :: Tuple ( input_pats. into_boxed_slice ( ) ) ) ,
1056
1054
..Default :: default ( )
1057
1055
} ) ,
1058
1056
} ;
@@ -1062,38 +1060,40 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
1062
1060
. map ( Box :: new)
1063
1061
. collect :: < Vec < _ > > ( )
1064
1062
. into_boxed_slice ( ) ;
1065
- qsc :: ast:: Item {
1063
+ qsc_ast :: ast:: Item {
1066
1064
id : NodeId :: default ( ) ,
1067
1065
span : whole_span,
1068
1066
doc : "" . into ( ) ,
1069
1067
attrs : attrs. into_boxed_slice ( ) ,
1070
- kind : Box :: new ( qsc :: ast:: ItemKind :: Callable ( Box :: new (
1071
- qsc :: ast:: CallableDecl {
1068
+ kind : Box :: new ( qsc_ast :: ast:: ItemKind :: Callable ( Box :: new (
1069
+ qsc_ast :: ast:: CallableDecl {
1072
1070
id : NodeId :: default ( ) ,
1073
1071
span : whole_span,
1074
- kind : qsc :: ast:: CallableKind :: Operation ,
1075
- name : Box :: new ( qsc :: ast:: Ident {
1072
+ kind : qsc_ast :: ast:: CallableKind :: Operation ,
1073
+ name : Box :: new ( qsc_ast :: ast:: Ident {
1076
1074
name : Rc :: from ( name. as_ref ( ) ) ,
1077
1075
..Default :: default ( )
1078
1076
} ) ,
1079
1077
generics : Box :: new ( [ ] ) ,
1080
1078
input,
1081
1079
output : Box :: new ( output_ty) ,
1082
1080
functors : None ,
1083
- body : Box :: new ( qsc:: ast:: CallableBody :: Block ( Box :: new ( qsc:: ast:: Block {
1084
- id : NodeId :: default ( ) ,
1085
- span : whole_span,
1086
- stmts,
1087
- } ) ) ) ,
1081
+ body : Box :: new ( qsc_ast:: ast:: CallableBody :: Block ( Box :: new (
1082
+ qsc_ast:: ast:: Block {
1083
+ id : NodeId :: default ( ) ,
1084
+ span : whole_span,
1085
+ stmts,
1086
+ } ,
1087
+ ) ) ) ,
1088
1088
} ,
1089
1089
) ) ) ,
1090
1090
}
1091
1091
}
1092
1092
1093
1093
pub ( crate ) fn build_arg_pat ( name : String , span : Span , ty : Ty ) -> Pat {
1094
- qsc :: ast:: Pat {
1095
- kind : Box :: new ( qsc :: ast:: PatKind :: Bind (
1096
- Box :: new ( qsc :: ast:: Ident {
1094
+ qsc_ast :: ast:: Pat {
1095
+ kind : Box :: new ( qsc_ast :: ast:: PatKind :: Bind (
1096
+ Box :: new ( qsc_ast :: ast:: Ident {
1097
1097
name : Rc :: from ( name) ,
1098
1098
span,
1099
1099
..Default :: default ( )
0 commit comments