parseConditional method

Expression parseConditional(
  1. bool allowIn
)

Implementation

Expression parseConditional(bool allowIn) {
  int? start = token!.startOffset;
  Expression exp = parseBinary(Precedence.EXPRESSION, allowIn);
  if (token!.type == Token.QUESTION) {
    Token quest = next();
    Expression thenExp = parseAssignment();
    consume(Token.COLON);
    Expression elseExp = parseAssignment(allowIn: allowIn);
    exp = ConditionalExpression(exp, thenExp, elseExp)
      ..start = start
      ..end = endOffset
      ..line = quest.line;
  }
  return exp;
}