File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -3829,7 +3829,7 @@ export class LuaTransformer {
38293829 }
38303830
38313831 protected transformProtectedConditionalExpression ( expression : ts . ConditionalExpression ) : tstl . CallExpression {
3832- const condition = this . transformExpression ( expression . condition ) ;
3832+ const condition = tstl . createParenthesizedExpression ( this . transformExpression ( expression . condition ) ) ;
38333833 const val1 = this . transformExpression ( expression . whenTrue ) ;
38343834 const val2 = this . transformExpression ( expression . whenFalse ) ;
38353835
@@ -3847,7 +3847,7 @@ export class LuaTransformer {
38473847 if ( tsHelper . isFalsible ( this . checker . getTypeAtLocation ( expression . whenTrue ) , isStrict ) ) {
38483848 return this . transformProtectedConditionalExpression ( expression ) ;
38493849 }
3850- const condition = this . transformExpression ( expression . condition ) ;
3850+ const condition = tstl . createParenthesizedExpression ( this . transformExpression ( expression . condition ) ) ;
38513851 const val1 = this . transformExpression ( expression . whenTrue ) ;
38523852 const val2 = this . transformExpression ( expression . whenFalse ) ;
38533853
Original file line number Diff line number Diff line change @@ -288,6 +288,10 @@ test.each([
288288 { input : "false ? 'a' : 'b'" } ,
289289 { input : "true ? false : true" } ,
290290 { input : "false ? false : true" } ,
291+ { input : "true || true ? 'a' : 'b'" } ,
292+ { input : "true || false ? 'a' : 'b'" } ,
293+ { input : "false || true ? 'a' : 'b'" } ,
294+ { input : "false || false ? 'a' : 'b'" } ,
291295 { input : "true ? literalValue : true" } ,
292296 { input : "true ? variableValue : true" } ,
293297 { input : "true ? maybeUndefinedValue : true" } ,
You can’t perform that action at this time.
0 commit comments