File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2163,6 +2163,7 @@ fn possible_operands(i: &mut TokenSlice) -> ModalResult<Expr> {
2163
2163
name. map ( Box :: new) . map ( Expr :: Name ) ,
2164
2164
array,
2165
2165
object. map ( Box :: new) . map ( Expr :: ObjectExpression ) ,
2166
+ if_expr. map ( Expr :: IfExpression ) ,
2166
2167
binary_expr_in_parens. map ( Box :: new) . map ( Expr :: BinaryExpression ) ,
2167
2168
unnecessarily_bracketed,
2168
2169
) )
@@ -3454,6 +3455,13 @@ mod tests {
3454
3455
binary_expression. parse ( tokens) . unwrap ( ) ;
3455
3456
}
3456
3457
3458
+ #[ test]
3459
+ fn parse_binary_operator_with_if_else ( ) {
3460
+ let tokens = crate :: parsing:: token:: lex ( "40 + if true { 2 } else { 0 }" , ModuleId :: default ( ) ) . unwrap ( ) ;
3461
+ let tokens = tokens. as_slice ( ) ;
3462
+ binary_expression. parse ( tokens) . unwrap ( ) ;
3463
+ }
3464
+
3457
3465
#[ test]
3458
3466
fn expression_in_array_index ( ) {
3459
3467
let tokens = crate :: parsing:: token:: lex ( "arr[x + 1]" , ModuleId :: default ( ) ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments