File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,14 @@ function traditionalTernaries(
100100 ] ) ;
101101}
102102
103+ function getOperandSingleExpression ( {
104+ variant
105+ } : Expression ) : Expression | undefined {
106+ return variant . kind === NonterminalKind . TupleExpression
107+ ? variant . items . getSingleExpression ( )
108+ : undefined ;
109+ }
110+
103111export class ConditionalExpression implements SlangNode {
104112 readonly kind = NonterminalKind . ConditionalExpression ;
105113
@@ -134,19 +142,12 @@ export class ConditionalExpression implements SlangNode {
134142 // `condition` must be a single `bool` value.
135143 const operandLoc = this . operand . loc ;
136144
137- const getOperandSingleExpression = ( ) : Expression | undefined => {
138- const operandVariant = this . operand . variant ;
139- return operandVariant . kind === NonterminalKind . TupleExpression
140- ? operandVariant . items . getSingleExpression ( )
141- : undefined ;
142- } ;
143-
144145 for (
145- let operandSingleExpression = getOperandSingleExpression ( ) ;
146+ let operandSingleExpression = getOperandSingleExpression ( this . operand ) ;
146147 operandSingleExpression &&
147148 operandSingleExpression . variant . kind !==
148149 NonterminalKind . ConditionalExpression ;
149- operandSingleExpression = getOperandSingleExpression ( )
150+ operandSingleExpression = getOperandSingleExpression ( this . operand )
150151 ) {
151152 this . operand = operandSingleExpression ;
152153 }
You can’t perform that action at this time.
0 commit comments