Package org.aspectj.org.eclipse.jdt.internal.compiler.ast

Examples of org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend


      return printPostfixExpression((PostfixExpression) statement);
    } else if (statement instanceof PrefixExpression) {
      return printPrefixExpression((PrefixExpression) statement);
    } else if (statement instanceof MessageSend) {
      printIndent(indent);
      MessageSend ms = (MessageSend) statement;
      printMessageSendStatement(ms);
      return output.append(';');
    } else if (statement instanceof QualifiedAllocationExpression) {
      printIndent(indent);
      printQualifiedAllocationExpression((QualifiedAllocationExpression) statement, indent);
View Full Code Here


    Expression fragment = fragments[0].receiver;
    int startingPositionInCascade = 1;
    if (!fragment.isImplicitThis()) {
      fragment.traverse(this, scope);
    } else {
      MessageSend currentMessageSend = fragments[1];
      final int numberOfParens = (currentMessageSend.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
      if (numberOfParens > 0) {
        manageOpeningParenthesizedExpression(currentMessageSend, numberOfParens);
      }
      ASTNode[] arguments = currentMessageSend.arguments;
      TypeReference[] typeArguments = currentMessageSend.typeArguments;
      if (typeArguments != null) {
          this.scribe.printNextToken(TerminalTokens.TokenNameLESS, this.preferences.insert_space_before_opening_angle_bracket_in_type_arguments);
          if (this.preferences.insert_space_after_opening_angle_bracket_in_type_arguments) {
            this.scribe.space();
          }
          int length = typeArguments.length;
          for (int i = 0; i < length - 1; i++) {
            typeArguments[i].traverse(this, scope);
            this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_type_arguments);
            if (this.preferences.insert_space_after_comma_in_type_arguments) {
              this.scribe.space();
            }       
          }
          typeArguments[length - 1].traverse(this, scope);
          if (isClosingGenericToken()) {
            this.scribe.printNextToken(CLOSING_GENERICS_EXPECTEDTOKENS, this.preferences.insert_space_before_closing_angle_bracket_in_type_arguments);
          }
          if (this.preferences.insert_space_after_closing_angle_bracket_in_type_arguments) {
            this.scribe.space();
          }
      }
      this.scribe.printNextToken(TerminalTokens.TokenNameIdentifier); // selector
      this.scribe.printNextToken(TerminalTokens.TokenNameLPAREN, this.preferences.insert_space_before_opening_paren_in_method_invocation);
      if (arguments != null) {
        if (this.preferences.insert_space_after_opening_paren_in_method_invocation) {
          this.scribe.space();
        }
        int argumentLength = arguments.length;
        Alignment argumentsAlignment = this.scribe.createAlignment(
            "messageArguments", //$NON-NLS-1$
            this.preferences.alignment_for_arguments_in_method_invocation,
            Alignment.R_OUTERMOST,
            argumentLength,
            this.scribe.scanner.currentPosition);
        this.scribe.enterAlignment(argumentsAlignment);
        boolean okForArguments = false;
        do {
          try {
            for (int j = 0; j < argumentLength; j++) {
              if (j > 0) {
                this.scribe.printNextToken(TerminalTokens.TokenNameCOMMA, this.preferences.insert_space_before_comma_in_method_invocation_arguments);
                this.scribe.printTrailingComment();
              }
              this.scribe.alignFragment(argumentsAlignment, j);
              if (j > 0 && this.preferences.insert_space_after_comma_in_method_invocation_arguments) {
                this.scribe.space();
              }
              arguments[j].traverse(this, scope);
            }
            okForArguments = true;
          } catch (AlignmentException e) {
            this.scribe.redoAlignment(e);
          }
        } while (!okForArguments);
        this.scribe.exitAlignment(argumentsAlignment, true);
        this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_before_closing_paren_in_method_invocation);
      } else {
        this.scribe.printNextToken(TerminalTokens.TokenNameRPAREN, this.preferences.insert_space_between_empty_parens_in_method_invocation);
      }
      if (numberOfParens > 0) {
        manageClosingParenthesizedExpression(currentMessageSend, numberOfParens);
      }
      startingPositionInCascade = 2;
    }
    Alignment cascadingMessageSendAlignment =
      this.scribe.createAlignment(
        "cascadingMessageSendAlignment", //$NON-NLS-1$
        this.preferences.alignment_for_selector_in_method_invocation,
        Alignment.R_INNERMOST,
        size,
        this.scribe.scanner.currentPosition);
    this.scribe.enterAlignment(cascadingMessageSendAlignment);
    boolean ok = false;
    do {
      try {
        this.scribe.alignFragment(cascadingMessageSendAlignment, 0);
        this.scribe.printNextToken(TerminalTokens.TokenNameDOT);
        for (int i = startingPositionInCascade; i < size; i++) {
          MessageSend currentMessageSend = fragments[i];
          final int numberOfParens = (currentMessageSend.bits & ASTNode.ParenthesizedMASK) >> ASTNode.ParenthesizedSHIFT;
          if (numberOfParens > 0) {
            manageOpeningParenthesizedExpression(currentMessageSend, numberOfParens);
          }
          TypeReference[] typeArguments = currentMessageSend.typeArguments;
View Full Code Here

  }

  boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
    Object oldNode = this.newAstToOldAst.get(methodInvocation);
    if (oldNode instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) oldNode;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = messageSend.binding;
      if (methodBinding instanceof ParameterizedGenericMethodBinding) {
        ParameterizedGenericMethodBinding genericMethodBinding = (ParameterizedGenericMethodBinding) methodBinding;
        return genericMethodBinding.inferredReturnType;
      }
View Full Code Here

  }

  boolean isResolvedTypeInferredFromExpectedType(SuperMethodInvocation superMethodInvocation) {
    Object oldNode = this.newAstToOldAst.get(superMethodInvocation);
    if (oldNode instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) oldNode;
      org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding methodBinding = messageSend.binding;
      if (methodBinding instanceof ParameterizedGenericMethodBinding) {
        ParameterizedGenericMethodBinding genericMethodBinding = (ParameterizedGenericMethodBinding) methodBinding;
        return genericMethodBinding.inferredReturnType;
      }
View Full Code Here

   * Method declared on BindingResolver.
   */
  synchronized IMethodBinding resolveMethod(MethodInvocation method) {
    Object oldNode = this.newAstToOldAst.get(method);
    if (oldNode instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) oldNode;
      return this.getMethodBinding(messageSend.binding);
    }
    return null;
  }
View Full Code Here

   * Method declared on BindingResolver.
   */
  synchronized IMethodBinding resolveMethod(SuperMethodInvocation method) {
    Object oldNode = this.newAstToOldAst.get(method);
    if (oldNode instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) oldNode;
      return this.getMethodBinding(messageSend.binding);
    }
    return null;
  }
View Full Code Here

      org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
      IVariableBinding field = this.getVariableBinding(fieldDeclaration.binding);
      if (field == null) return null;
      return field.getType();
    } else if (node instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) node;
      IMethodBinding method = getMethodBinding(messageSend.binding);
      if (method == null) return null;
      return method.getReturnType();
    } else if (node instanceof AllocationExpression) {
      AllocationExpression allocation = (AllocationExpression) node;
View Full Code Here

      }
    } else if (node instanceof org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
      org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (org.aspectj.org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) node;
      return this.getVariableBinding(fieldDeclaration.binding);
    } else if (node instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) node;
      return getMethodBinding(messageSend.binding);
    } else if (node instanceof AllocationExpression) {
      AllocationExpression allocation = (AllocationExpression) node;
      return getMethodBinding(allocation.binding);
    } else if (node instanceof JavadocImplicitTypeReference) {
View Full Code Here

  }
 
  protected void consumeMethodInvocationName() {
    super.consumeMethodInvocationName();

    MessageSend m = (MessageSend)expressionStack[expressionPtr];
    if (CharOperation.equals(m.selector, "proceed".toCharArray())) {
      expressionStack[expressionPtr] = declarationFactory.createProceed(m);
    }
  }
View Full Code Here

      if (inferenceContext.hasUnresolvedTypeArgument()) {
        if (methodSubstitute.returnType != TypeBinding.VOID) {
          TypeBinding expectedType = null;
          // if message invocation has expected type
          if (invocationSite instanceof MessageSend) {
            MessageSend message = (MessageSend) invocationSite;
            expectedType = message.expectedType;
          }
          if (expectedType != null) {
            // record it was explicit from context, as opposed to assumed by default (see below)
            inferenceContext.hasExplicitExpectedType = true;
View Full Code Here

TOP

Related Classes of org.aspectj.org.eclipse.jdt.internal.compiler.ast.MessageSend

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.