@@ -5,14 +5,12 @@ use std::rc::Rc;
55
66use num_bigint:: BigInt ;
77
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 ,
1512} ;
13+ use qsc_data_structures:: span:: Span ;
1614
1715use crate :: {
1816 runtime:: RuntimeFunctions ,
@@ -203,7 +201,7 @@ where
203201 }
204202}
205203
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 {
207205 Expr {
208206 id : NodeId :: default ( ) ,
209207 span,
@@ -231,15 +229,15 @@ pub(crate) fn build_lit_result_array_expr_from_bitstring<S: AsRef<str>>(
231229 build_lit_result_array_expr ( values, span)
232230}
233231
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 {
235233 let exprs: Vec < _ > = values
236234 . into_iter ( )
237235 . map ( |v| build_lit_result_expr ( v, Span :: default ( ) ) )
238236 . collect ( ) ;
239237 build_expr_array_expr ( exprs, span)
240238}
241239
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 {
243241 let exprs: Vec < _ > = values. into_iter ( ) . map ( Box :: new) . collect ( ) ;
244242 Expr {
245243 id : NodeId :: default ( ) ,
@@ -314,7 +312,7 @@ pub(crate) fn build_binary_expr(
314312 }
315313}
316314
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 {
318316 matches ! (
319317 op,
320318 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>>(
10051003 ns : S ,
10061004 entry : ast:: Item ,
10071005) -> TopLevelNode {
1008- TopLevelNode :: Namespace ( qsc :: ast:: Namespace {
1006+ TopLevelNode :: Namespace ( qsc_ast :: ast:: Namespace {
10091007 id : NodeId :: default ( ) ,
10101008 span : whole_span,
10111009 name : [ Ident {
@@ -1031,10 +1029,10 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
10311029 // as an entry point. We will get a Q# compilation error if we
10321030 // attribute an operation with EntryPoint and it has input parameters.
10331031 if input_pats. is_empty ( ) {
1034- attrs. push ( Box :: new ( qsc :: ast:: Attr {
1032+ attrs. push ( Box :: new ( qsc_ast :: ast:: Attr {
10351033 id : NodeId :: default ( ) ,
10361034 span : Span :: default ( ) ,
1037- name : Box :: new ( qsc :: ast:: Ident {
1035+ name : Box :: new ( qsc_ast :: ast:: Ident {
10381036 name : Rc :: from ( "EntryPoint" ) ,
10391037 ..Default :: default ( )
10401038 } ) ,
@@ -1044,15 +1042,15 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
10441042 let input_pats = input_pats. into_iter ( ) . map ( Box :: new) . collect :: < Vec < _ > > ( ) ;
10451043 let input = match input_pats. len ( ) {
10461044 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 ( ) ) ) ,
10481046 ..Default :: default ( )
10491047 } ) ,
10501048 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 ( ) ) ) ,
10521050 ..Default :: default ( )
10531051 } ) ,
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 ( ) ) ) ,
10561054 ..Default :: default ( )
10571055 } ) ,
10581056 } ;
@@ -1062,38 +1060,40 @@ pub(crate) fn build_operation_with_stmts<S: AsRef<str>>(
10621060 . map ( Box :: new)
10631061 . collect :: < Vec < _ > > ( )
10641062 . into_boxed_slice ( ) ;
1065- qsc :: ast:: Item {
1063+ qsc_ast :: ast:: Item {
10661064 id : NodeId :: default ( ) ,
10671065 span : whole_span,
10681066 doc : "" . into ( ) ,
10691067 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 {
10721070 id : NodeId :: default ( ) ,
10731071 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 {
10761074 name : Rc :: from ( name. as_ref ( ) ) ,
10771075 ..Default :: default ( )
10781076 } ) ,
10791077 generics : Box :: new ( [ ] ) ,
10801078 input,
10811079 output : Box :: new ( output_ty) ,
10821080 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+ ) ) ) ,
10881088 } ,
10891089 ) ) ) ,
10901090 }
10911091}
10921092
10931093pub ( 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 {
10971097 name : Rc :: from ( name) ,
10981098 span,
10991099 ..Default :: default ( )
0 commit comments