Package com.google.dart.engine.scanner

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


    promoteManager = resolver.getPromoteManager();
  }

  @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();
View Full Code Here


    return null;
  }

  @Override
  public Void visitBinaryExpression(BinaryExpression node) {
    Token operator = node.getOperator();
    if (operator.isUserDefinableOperator()) {
      Expression leftOperand = node.getLeftOperand();
      if (leftOperand != null) {
        String methodName = operator.getLexeme();

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

    return null;
  }

  @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);
View Full Code Here

    boolean shouldReportMissingMember_propagated = !shouldReportMissingMember_static && enableHints
        && shouldReportMissingMember(propagatedType, propagatedMethod)
        && !memberFoundInSubclass(propagatedType.getElement(), methodName, true, false);

    if (shouldReportMissingMember_static || shouldReportMissingMember_propagated) {
      Token leftBracket = node.getLeftBracket();
      Token rightBracket = node.getRightBracket();
      ErrorCode errorCode = shouldReportMissingMember_static
          ? StaticTypeWarningCode.UNDEFINED_OPERATOR : HintCode.UNDEFINED_OPERATOR;
      if (leftBracket == null || rightBracket == null) {
        if (doesntHaveProxy(shouldReportMissingMember_static ? staticType.getElement()
            : propagatedType.getElement())) {
          resolver.reportErrorForNode(errorCode, node, methodName, shouldReportMissingMember_static
              ? staticType.getDisplayName() : propagatedType.getDisplayName());
        }
      } else {
        int offset = leftBracket.getOffset();
        int length = rightBracket.getOffset() - offset + 1;
        if (doesntHaveProxy(shouldReportMissingMember_static ? staticType.getElement()
            : propagatedType.getElement())) {
          resolver.reportErrorForOffset(
              errorCode,
              offset,
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) {
      return "unary-";
    } else {
      return operator.getLexeme();
    }
  }
View Full Code Here

  /**
   * @return {@code true} if the name of the given {@link TypeName} is an built-in identifier.
   */
  private static boolean isBuiltInIdentifier(TypeName node) {
    Token token = node.getName().getBeginToken();
    return token.getType() == TokenType.KEYWORD;
  }
View Full Code Here

  @Override
  public Void visitFunctionDeclaration(FunctionDeclaration node) {
    ExecutableElement outerExecutable = enclosingExecutable;
    try {
      SimpleIdentifier functionName = node.getName();
      Token property = node.getPropertyKeyword();
      if (property == null) {
        if (enclosingExecutable != null) {
          enclosingExecutable = findIdentifier(enclosingExecutable.getFunctions(), functionName);
        } else {
          enclosingExecutable = findIdentifier(enclosingUnit.getFunctions(), functionName);
View Full Code Here

  @Override
  public Void visitMethodDeclaration(MethodDeclaration node) {
    ExecutableElement outerExecutable = enclosingExecutable;
    try {
      Token property = node.getPropertyKeyword();
      SimpleIdentifier methodName = node.getName();
      String nameOfMethod = methodName.getName();
      if (nameOfMethod.equals(TokenType.MINUS.getLexeme())
          && node.getParameters().getParameters().size() == 0) {
        nameOfMethod = "unary-";
View Full Code Here

    return directive;
  }

  @Override
  public IndexExpression visitIndexExpression(IndexExpression node) {
    Token period = node.getPeriod();
    if (period == null) {
      return new IndexExpression(
          cloneNode(node.getTarget()),
          node.getLeftBracket(),
          cloneNode(node.getIndex()),
View Full Code Here

        mapToken(node.getSemicolon()));
  }

  @Override
  public IndexExpression visitIndexExpression(IndexExpression node) {
    Token period = mapToken(node.getPeriod());
    IndexExpression copy;
    if (period == null) {
      copy = new IndexExpression(
          cloneNode(node.getTarget()),
          mapToken(node.getLeftBracket()),
View Full Code Here

TOP

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

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.