Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.IBinding


    if (!fBindingsResolved) {
      fNeedBindings = true;
      return false;
    }
    // if node is a variable with a constant value (static final field)
    IBinding binding = node.resolveBinding();
    if (binding != null && binding.getKind() == IBinding.VARIABLE) {
      return ((IVariableBinding) binding).getConstantValue() != null;
    }
    return false;
  }
View Full Code Here


    final IASTExpression expr = new ExpressionInfo(castExpression.getExpression(), typeDeclaration, compilationUnitInfo).getExpression();
    return f.newCastExpression(operator, typeId, expr);
  }

  private IASTExpression convertSimleName(final SimpleName simpleName) {
    final IBinding binding = simpleName.resolveBinding();
    final ITypeBinding typeBinding = simpleName.resolveTypeBinding();
    if (binding.getKind() == IBinding.VARIABLE) {
      final IVariableBinding variableBinding = (IVariableBinding) binding;
      if (variableBinding.isEnumConstant()) {
        final ICPPASTQualifiedName qualifiedName = f.newQualifiedName();
        qualifiedName.addName(f.newName(typeBinding.getName().toCharArray()));
        qualifiedName.addName(new NameInfo(simpleName).getName());
View Full Code Here

    }
    return f.newIdExpression(new NameInfo(simpleName).getName());
  }

  private IASTExpression convertQualifiedName(final QualifiedName qualifiedName) {
    final IBinding binding = qualifiedName.resolveBinding();
    final ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
    if (binding.getKind() == IBinding.VARIABLE) {
      final IVariableBinding variableBinding = (IVariableBinding) binding;
      if (variableBinding.isEnumConstant()) {
        final ICPPASTQualifiedName qName = f.newQualifiedName();
        qName.addName(f.newName(typeBinding.getName().toCharArray()));
        qName.addName(new NameInfo(qualifiedName.getName()).getName());
View Full Code Here

  }
 
  public static boolean isFinal(Name node) {
    //we deal with qualified name
    while (true) {
      IBinding binding = node.resolveBinding();
      if (binding == null)
        return false;
      if (binding.getKind() != IBinding.VARIABLE)
        return false;
      IVariableBinding variableBinding = (IVariableBinding) binding;
      if (variableBinding.isField()) {
        if ((variableBinding.getModifiers() & org.eclipse.jdt.core.dom.Modifier.FINAL) == 0)
          return false;
View Full Code Here

    //we deal with qualified name
    if (node.isSimpleName())
      return false;
    QualifiedName qn = (QualifiedName) node;
    while (true) {
      IBinding binding = qn.resolveBinding();
      if (binding == null)
        return false;
      if (binding.getKind() != IBinding.VARIABLE)
        return false;
      IVariableBinding variableBinding = (IVariableBinding) binding;
      assert variableBinding.isField();
      if ((variableBinding.getModifiers() & org.eclipse.jdt.core.dom.Modifier.FINAL) == 0)
        return false;
View Full Code Here

    }
    return true;
  }

  public static boolean isFinalFieldAccess(SimpleName node) {
    IBinding binding = node.resolveBinding();
    if (binding == null)
      return false;
    if (binding.getKind() != IBinding.VARIABLE)
      return false;
    return (((IVariableBinding) binding).getModifiers() & org.eclipse.jdt.core.dom.Modifier.FINAL) != 0;
  }
View Full Code Here

    }
  }

  private void updateScope(Name node) {
    Element xml = (Element) xmlElementStack.peek();
    IBinding binding = Utils.getBinding(node);
    if (binding != null && binding.getKind() == IBinding.VARIABLE) {
      IVariableBinding varBinding = (IVariableBinding) binding;
      if (varBinding.isField()) {
        xml.setAttribute("scope", "field");
        if ((varBinding.getModifiers() & org.eclipse.jdt.core.dom.Modifier.PRIVATE) > 0) {
          xml.setAttribute("private", varBinding.getDeclaringClass()
View Full Code Here

  private void updateBindings(ASTNode node) {
    if (!insideIfCondition)
      return;
    if (node instanceof Name) {
      IBinding binding = ((Name) node).resolveBinding();
      if (namesFromHeap.contains(binding)) {
        namesFromHeap.remove(binding);
        currentIfConditionbindings.add(binding);
      }
    }
View Full Code Here

    }
    for (int i = 0; i < node.parameters().size(); i++) {
      SingleVariableDeclaration dec = (SingleVariableDeclaration) node
          .parameters().get(i);
      if (!dec.getType().isPrimitiveType()) {
        IBinding binding = dec.getName().resolveBinding();
        namesFromHeap.add(binding);
      }
      // System.out.println(dec);
    }
    return true;
View Full Code Here

    }
    return tryGetVariable((Name) expr);
  }
 
  public static Variable tryGetVariable(Name name) {
    IBinding binding = name.resolveBinding();
    if (binding == null)
      throw new FatalAIError("Cannot resolve type binding for: '%s'", name);
    if (binding.getKind() != IBinding.VARIABLE)
      return null;
    IVariableBinding varBinding = (IVariableBinding) binding;
    if (varBinding.isField())
      return null;
    IMethodBinding variableMethod = varBinding.getDeclaringMethod();
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.IBinding

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.