()
| 219 | } |
| 220 | |
| 221 | function conditionalExpression(): ASTNodeOrNull { |
| 222 | const ast = logicalOrExpression(); |
| 223 | |
| 224 | if (!ast) { |
| 225 | return null; |
| 226 | } |
| 227 | |
| 228 | if (matchPunctuator('?')) { |
| 229 | next(); |
| 230 | let consequent = assignmentExpression(); |
| 231 | assert(consequent); |
| 232 | assert(matchPunctuator(':')); |
| 233 | |
| 234 | next(); |
| 235 | let alternate = assignmentExpression(); |
| 236 | assert(alternate); |
| 237 | |
| 238 | return { |
| 239 | type: 'conditional', |
| 240 | test: ast, |
| 241 | consequent: consequent, |
| 242 | alternate: alternate, |
| 243 | start: ast.start, |
| 244 | end: alternate!.end |
| 245 | }; |
| 246 | } |
| 247 | |
| 248 | return ast; |
| 249 | } |
| 250 | |
| 251 | function binaryExpressionParser( |
| 252 | type: string, |
no test coverage detected