File tree Expand file tree Collapse file tree 4 files changed +9
-24
lines changed
Expand file tree Collapse file tree 4 files changed +9
-24
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ impl TranslateModule for Failed {
8787 if self . is_parsed {
8888 let block = self . block . translate ( meta) ;
8989 // the condition of '$?' clears the status code thus we need to store it in a variable
90- let status_variable_stmt = VarStmtFragment :: new ( "__status" , Type :: Num , fragments ! ( "$?" ) ) ;
90+ let status_variable_stmt = VarStmtFragment :: new ( "__status" , Type :: Int , fragments ! ( "$?" ) ) ;
9191 let status_variable_expr = VarExprFragment :: from_stmt ( & status_variable_stmt) ;
9292 if self . is_question_mark {
9393 // Set default return value if failure happened in a function
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ impl TranslateModule for Succeeded {
6565 if self . is_parsed {
6666 let block = self . block . translate ( meta) ;
6767 // the condition of '$?' clears the status code thus we need to store it in a variable
68- let status_variable_stmt = VarStmtFragment :: new ( "__status" , Type :: Num , fragments ! ( "$?" ) ) ;
68+ let status_variable_stmt = VarStmtFragment :: new ( "__status" , Type :: Int , fragments ! ( "$?" ) ) ;
6969 let status_variable_expr = VarExprFragment :: from_stmt ( & status_variable_stmt) ;
7070
7171 match & block {
Original file line number Diff line number Diff line change @@ -77,19 +77,23 @@ impl TranslateModule for Then {
7777 fn translate ( & self , meta : & mut TranslateMetadata ) -> FragmentKind {
7878 if self . is_parsed {
7979 let block = self . block . translate ( meta) ;
80+ // the condition of '$?' clears the status code thus we need to store it in a variable
81+ let status_variable_stmt = VarStmtFragment :: new ( "__status" , Type :: Int , fragments ! ( "$?" ) ) ;
82+ let status_variable_expr = VarExprFragment :: from_stmt ( & status_variable_stmt) ;
8083
8184 match & block {
8285 FragmentKind :: Empty => {
83- FragmentKind :: Empty
86+ status_variable_stmt . to_frag ( )
8487 } ,
8588 FragmentKind :: Block ( block) if block. statements . is_empty ( ) => {
86- FragmentKind :: Empty
89+ status_variable_stmt . to_frag ( )
8790 } ,
8891 _ => {
89- let param_assignment = VarStmtFragment :: new ( & self . param_name , Type :: Int , fragments ! ( "$?" ) )
92+ let param_assignment = VarStmtFragment :: new ( & self . param_name , Type :: Int , status_variable_expr . to_frag ( ) )
9093 . with_global_id ( self . param_global_id ) ;
9194
9295 BlockFragment :: new ( vec ! [
96+ status_variable_stmt. to_frag( ) ,
9397 param_assignment. to_frag( ) ,
9498 block,
9599 ] , false ) . to_frag ( )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments