@@ -554,7 +554,7 @@ impl Compiler {
554
554
555
555
fn compile_statement ( & mut self , statement : & ast:: Stmt ) -> CompileResult < ( ) > {
556
556
trace ! ( "Compiling {:?}" , statement) ;
557
- self . set_source_location ( statement. location ) ;
557
+ self . set_source_location ( statement. start ( ) ) ;
558
558
use ast:: StmtKind :: * ;
559
559
560
560
match & statement. node {
@@ -598,8 +598,9 @@ impl Compiler {
598
598
599
599
let from_list = if import_star {
600
600
if self . ctx . in_func ( ) {
601
- return Err ( self
602
- . error_loc ( CodegenErrorType :: FunctionImportStar , statement. location ) ) ;
601
+ return Err (
602
+ self . error_loc ( CodegenErrorType :: FunctionImportStar , statement. start ( ) )
603
+ ) ;
603
604
}
604
605
vec ! [ ConstantData :: Str {
605
606
value: "*" . to_owned( ) ,
@@ -800,7 +801,7 @@ impl Compiler {
800
801
emit ! ( self , Instruction :: Break { target: end } ) ;
801
802
}
802
803
None => {
803
- return Err ( self . error_loc ( CodegenErrorType :: InvalidBreak , statement. location ) ) ;
804
+ return Err ( self . error_loc ( CodegenErrorType :: InvalidBreak , statement. start ( ) ) ) ;
804
805
}
805
806
} ,
806
807
Continue => match self . ctx . loop_data {
@@ -809,13 +810,13 @@ impl Compiler {
809
810
}
810
811
None => {
811
812
return Err (
812
- self . error_loc ( CodegenErrorType :: InvalidContinue , statement. location )
813
+ self . error_loc ( CodegenErrorType :: InvalidContinue , statement. start ( ) )
813
814
) ;
814
815
}
815
816
} ,
816
817
Return { value } => {
817
818
if !self . ctx . in_func ( ) {
818
- return Err ( self . error_loc ( CodegenErrorType :: InvalidReturn , statement. location ) ) ;
819
+ return Err ( self . error_loc ( CodegenErrorType :: InvalidReturn , statement. start ( ) ) ) ;
819
820
}
820
821
match value {
821
822
Some ( v) => {
@@ -825,10 +826,8 @@ impl Compiler {
825
826
. flags
826
827
. contains ( bytecode:: CodeFlags :: IS_GENERATOR )
827
828
{
828
- return Err ( self . error_loc (
829
- CodegenErrorType :: AsyncReturnValue ,
830
- statement. location ,
831
- ) ) ;
829
+ return Err ( self
830
+ . error_loc ( CodegenErrorType :: AsyncReturnValue , statement. start ( ) ) ) ;
832
831
}
833
832
self . compile_expression ( v) ?;
834
833
}
@@ -1487,7 +1486,7 @@ impl Compiler {
1487
1486
1488
1487
match & item. optional_vars {
1489
1488
Some ( var) => {
1490
- self . set_source_location ( var. location ) ;
1489
+ self . set_source_location ( var. start ( ) ) ;
1491
1490
self . compile_store ( var) ?;
1492
1491
}
1493
1492
None => {
@@ -1763,7 +1762,7 @@ impl Compiler {
1763
1762
. ok_or_else ( || {
1764
1763
self . error_loc (
1765
1764
CodegenErrorType :: TooManyStarUnpack ,
1766
- target. location ,
1765
+ target. start ( ) ,
1767
1766
)
1768
1767
} ) ?;
1769
1768
let args = bytecode:: UnpackExArgs { before, after } ;
@@ -2038,7 +2037,7 @@ impl Compiler {
2038
2037
2039
2038
fn compile_expression ( & mut self , expression : & ast:: Expr ) -> CompileResult < ( ) > {
2040
2039
trace ! ( "Compiling {:?}" , expression) ;
2041
- self . set_source_location ( expression. location ) ;
2040
+ self . set_source_location ( expression. start ( ) ) ;
2042
2041
2043
2042
use ast:: ExprKind :: * ;
2044
2043
match & expression. node {
0 commit comments