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

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


  public static final String MAGIC_CLASS = "com.google.gwt.core.client.GWT";
  public static final String REBIND_MAGIC_METHOD = "create";
  public static final String ASYNC_MAGIC_METHOD = "runAsync";

  public static void reportRebindProblem(MessageSendSite site, String message) {
    MessageSend messageSend = site.messageSend;
    Scope scope = site.scope;
    // Safe since CUS.referenceContext is set in its constructor.
    CompilationUnitDeclaration cud = scope.compilationUnitScope().referenceContext;
    GWTProblem.recordError(messageSend, cud, message, null);
  }
View Full Code Here


  public static final String MAGIC_CLASS = "com.google.gwt.core.client.GWT";
  public static final String REBIND_MAGIC_METHOD = "create";
  public static final String ASYNC_MAGIC_METHOD = "runAsync";

  public static void reportRebindProblem(MessageSendSite site, String message) {
    MessageSend messageSend = site.messageSend;
    Scope scope = site.scope;
    // Safe since CUS.referenceContext is set in its constructor.
    CompilationUnitDeclaration cud = scope.compilationUnitScope().referenceContext;
    GWTProblem.recordInCud(messageSend, cud, message, null);
  }
View Full Code Here

  }

  boolean isResolvedTypeInferredFromExpectedType(MethodInvocation methodInvocation) {
    Object oldNode = this.newAstToOldAst.get(methodInvocation);
    if (oldNode instanceof MessageSend) {
      MessageSend messageSend = (MessageSend) oldNode;
      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.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 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 getMethodBinding(messageSend.binding);
    }
    return null;
  }
View Full Code Here

      org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (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

      return this.getTypeBinding(binding.leafComponentType());
    } else if (node instanceof org.eclipse.jdt.internal.compiler.ast.FieldDeclaration) {
      org.eclipse.jdt.internal.compiler.ast.FieldDeclaration fieldDeclaration = (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

    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(
            Alignment.MESSAGE_ARGUMENTS,
            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.printComment(CodeFormatter.K_UNKNOWN, Scribe.BASIC_TRAILING_COMMENT);
              }
              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;
    }
    int tieBreakRule = this.preferences.wrap_outer_expressions_when_nested && size-startingPositionInCascade > 2
      ? Alignment.R_OUTERMOST
      : Alignment.R_INNERMOST;
    Alignment cascadingMessageSendAlignment =
      this.scribe.createAlignment(
        Alignment.CASCADING_MESSAGE_SEND,
        this.preferences.alignment_for_selector_in_method_invocation,
        tieBreakRule,
        size,
        this.scribe.scanner.currentPosition);
    this.scribe.enterAlignment(cascadingMessageSendAlignment);
    boolean ok = false;
    boolean setStartingColumn = true;
    switch (this.preferences.alignment_for_arguments_in_method_invocation & Alignment.SPLIT_MASK) {
      case Alignment.M_COMPACT_FIRST_BREAK_SPLIT:
      case Alignment.M_NEXT_SHIFTED_SPLIT:
      case Alignment.M_ONE_PER_LINE_SPLIT:
        setStartingColumn = false;
        break;
    }
    do {
      if (setStartingColumn) {
        cascadingMessageSendAlignment.startingColumn = this.scribe.column;
      }
      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

  public static final String REBIND_MAGIC_CLASS = "com.google.gwt.core.client.GWT";
  public static final String REBIND_MAGIC_METHOD = "create";

  public static void reportRebindProblem(DeferredBindingSite site,
      String message) {
    MessageSend messageSend = site.messageSend;
    Scope scope = site.scope;
    // Safe since CUS.referenceContext is set in its constructor.
    CompilationUnitDeclaration cud = scope.compilationUnitScope().referenceContext;
    GWTProblem.recordInCud(messageSend, cud, message, null);
  }
View Full Code Here

TOP

Related Classes of 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.