Package com.google.dart.engine.scanner

Examples of com.google.dart.engine.scanner.TokenType


    return super.visitAsExpression(node);
  }

  @Override
  public Void visitAssignmentExpression(AssignmentExpression node) {
    TokenType operatorType = node.getOperator().getType();
    if (operatorType == TokenType.EQ) {
      checkForUseOfVoidResult(node.getRightHandSide());
      checkForInvalidAssignment(node.getLeftHandSide(), node.getRightHandSide());
    } else {
      checkForDeprecatedMemberUse(node.getBestElement(), node);
View Full Code Here


  }

  @Override
  public Boolean visitBinaryExpression(BinaryExpression node) {
    Expression lhsExpression = node.getLeftOperand();
    TokenType operatorType = node.getOperator().getType();
    // If the operator is || and the left hand side is false literal, don't consider the RHS of the
    // binary expression.
    // TODO(jwren) Do we want to take constant expressions into account, evaluate if(false) {}
    // differently than if(<condition>), when <condition> evaluates to a constant false value?
    if (operatorType == TokenType.BAR_BAR) {
View Full Code Here

  @Override
  public EvaluationResultImpl visitBinaryExpression(BinaryExpression node) {
    EvaluationResultImpl leftResult = node.getLeftOperand().accept(this);
    EvaluationResultImpl rightResult = node.getRightOperand().accept(this);
    TokenType operatorType = node.getOperator().getType();
    // 'null' is almost never good operand
    if (operatorType != TokenType.BANG_EQ && operatorType != TokenType.EQ_EQ) {
      if (leftResult instanceof ValidResult && ((ValidResult) leftResult).isNull()
          || rightResult instanceof ValidResult && ((ValidResult) rightResult).isNull()) {
        return error(node, CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION);
View Full Code Here

    return super.visitAssertStatement(node);
  }

  @Override
  public Void visitAssignmentExpression(AssignmentExpression node) {
    TokenType operatorType = node.getOperator().getType();
    Expression lhs = node.getLeftHandSide();
    Expression rhs = node.getRightHandSide();
    if (operatorType == TokenType.EQ) {
      checkForInvalidAssignment(lhs, rhs);
    } else {
View Full Code Here

  }

  @Override
  public Void visitBinaryExpression(BinaryExpression node) {
    Token operator = node.getOperator();
    TokenType type = operator.getType();
    if (type == TokenType.AMPERSAND_AMPERSAND || type == TokenType.BAR_BAR) {
      String lexeme = operator.getLexeme();
      checkForAssignability(
          node.getLeftOperand(),
          boolType,
View Full Code Here

    return super.visitPrefixedIdentifier(node);
  }

  @Override
  public Void visitPrefixExpression(PrefixExpression node) {
    TokenType operatorType = node.getOperator().getType();
    Expression operand = node.getOperand();
    if (operatorType == TokenType.BANG) {
      checkForNonBoolNegationExpression(operand);
    } else if (operatorType.isIncrementOperator()) {
      checkForAssignmentToFinal(operand);
    }
    checkForIntNotAssignable(operand);
    return super.visitPrefixExpression(node);
  }
View Full Code Here

  }

  @Override
  public Void visitAssignmentExpression(AssignmentExpression node) {
    Token operator = node.getOperator();
    TokenType operatorType = operator.getType();
    if (operatorType != TokenType.EQ) {
      operatorType = operatorFromCompoundAssignment(operatorType);
      Expression leftHandSide = node.getLeftHandSide();
      if (leftHandSide != null) {
        String methodName = operatorType.getLexeme();

        Type staticType = getStaticType(leftHandSide);
        MethodElement staticMethod = lookUpMethod(leftHandSide, staticType, methodName);
        node.setStaticElement(staticMethod);
View Full Code Here

  }

  @Override
  public Void visitPrefixExpression(PrefixExpression node) {
    Token operator = node.getOperator();
    TokenType operatorType = operator.getType();
    if (operatorType.isUserDefinableOperator() || operatorType == TokenType.PLUS_PLUS
        || operatorType == TokenType.MINUS_MINUS) {
      Expression operand = node.getOperand();
      String methodName = getPrefixOperator(node);

      Type staticType = getStaticType(operand);
View Full Code Here

   * @param node the postfix expression being invoked
   * @return the name of the method invoked by the expression
   */
  private String getPrefixOperator(PrefixExpression node) {
    Token operator = node.getOperator();
    TokenType operatorType = operator.getType();
    if (operatorType == TokenType.PLUS_PLUS) {
      return TokenType.PLUS.getLexeme();
    } else if (operatorType == TokenType.MINUS_MINUS) {
      return TokenType.MINUS.getLexeme();
    } else if (operatorType == TokenType.MINUS) {
View Full Code Here

    return null;
  }

  @Override
  public Void visitBinaryExpression(BinaryExpression node) {
    TokenType operatorType = node.getOperator().getType();
    Expression leftOperand = node.getLeftOperand();
    Expression rightOperand = node.getRightOperand();
    if (operatorType == TokenType.AMPERSAND_AMPERSAND) {
      safelyVisit(leftOperand);
      if (rightOperand != null) {
View Full Code Here

TOP

Related Classes of com.google.dart.engine.scanner.TokenType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.