@@ -554,7 +554,7 @@ impl Compiler {
554554
555555 fn compile_statement ( & mut self , statement : & ast:: Stmt ) -> CompileResult < ( ) > {
556556 trace ! ( "Compiling {:?}" , statement) ;
557- self . set_source_location ( statement. location ) ;
557+ self . set_source_location ( statement. start ( ) ) ;
558558 use ast:: StmtKind :: * ;
559559
560560 match & statement. node {
@@ -598,8 +598,9 @@ impl Compiler {
598598
599599 let from_list = if import_star {
600600 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+ ) ;
603604 }
604605 vec ! [ ConstantData :: Str {
605606 value: "*" . to_owned( ) ,
@@ -800,7 +801,7 @@ impl Compiler {
800801 emit ! ( self , Instruction :: Break { target: end } ) ;
801802 }
802803 None => {
803- return Err ( self . error_loc ( CodegenErrorType :: InvalidBreak , statement. location ) ) ;
804+ return Err ( self . error_loc ( CodegenErrorType :: InvalidBreak , statement. start ( ) ) ) ;
804805 }
805806 } ,
806807 Continue => match self . ctx . loop_data {
@@ -809,13 +810,13 @@ impl Compiler {
809810 }
810811 None => {
811812 return Err (
812- self . error_loc ( CodegenErrorType :: InvalidContinue , statement. location )
813+ self . error_loc ( CodegenErrorType :: InvalidContinue , statement. start ( ) )
813814 ) ;
814815 }
815816 } ,
816817 Return { value } => {
817818 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 ( ) ) ) ;
819820 }
820821 match value {
821822 Some ( v) => {
@@ -825,10 +826,8 @@ impl Compiler {
825826 . flags
826827 . contains ( bytecode:: CodeFlags :: IS_GENERATOR )
827828 {
828- return Err ( self . error_loc (
829- CodegenErrorType :: AsyncReturnValue ,
830- statement. location ,
831- ) ) ;
829+ return Err ( self
830+ . error_loc ( CodegenErrorType :: AsyncReturnValue , statement. start ( ) ) ) ;
832831 }
833832 self . compile_expression ( v) ?;
834833 }
@@ -1487,7 +1486,7 @@ impl Compiler {
14871486
14881487 match & item. optional_vars {
14891488 Some ( var) => {
1490- self . set_source_location ( var. location ) ;
1489+ self . set_source_location ( var. start ( ) ) ;
14911490 self . compile_store ( var) ?;
14921491 }
14931492 None => {
@@ -1763,7 +1762,7 @@ impl Compiler {
17631762 . ok_or_else ( || {
17641763 self . error_loc (
17651764 CodegenErrorType :: TooManyStarUnpack ,
1766- target. location ,
1765+ target. start ( ) ,
17671766 )
17681767 } ) ?;
17691768 let args = bytecode:: UnpackExArgs { before, after } ;
@@ -2038,7 +2037,7 @@ impl Compiler {
20382037
20392038 fn compile_expression ( & mut self , expression : & ast:: Expr ) -> CompileResult < ( ) > {
20402039 trace ! ( "Compiling {:?}" , expression) ;
2041- self . set_source_location ( expression. location ) ;
2040+ self . set_source_location ( expression. start ( ) ) ;
20422041
20432042 use ast:: ExprKind :: * ;
20442043 match & expression. node {
0 commit comments