@@ -820,13 +820,13 @@ def on_begin(bodystmt)
820820 end
821821
822822 bodystmt . bind (
823- keyword . location . end_char ,
823+ find_next_statement_start ( keyword . location . end_char ) ,
824824 keyword . location . end_column ,
825825 end_location . end_char ,
826826 end_location . end_column
827827 )
828- location = keyword . location . to ( bodystmt . location )
829828
829+ location = keyword . location . to ( end_location )
830830 Begin . new ( bodystmt : bodystmt , location : location )
831831 end
832832 end
@@ -905,14 +905,15 @@ def on_blockarg(name)
905905 # (nil | Ensure) ensure_clause
906906 # ) -> BodyStmt
907907 def on_bodystmt ( statements , rescue_clause , else_clause , ensure_clause )
908+ parts = [ statements , rescue_clause , else_clause , ensure_clause ] . compact
909+
908910 BodyStmt . new (
909911 statements : statements ,
910912 rescue_clause : rescue_clause ,
911913 else_keyword : else_clause && consume_keyword ( :else ) ,
912914 else_clause : else_clause ,
913915 ensure_clause : ensure_clause ,
914- location :
915- Location . fixed ( line : lineno , char : char_pos , column : current_column )
916+ location : parts . first . location . to ( parts . last . location )
916917 )
917918 end
918919
0 commit comments