Package org.eclipse.jdt.core.dom

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


    return canDeclareAutoX(vdf);
  }

  private static boolean canDeclareAutoX(VariableDeclarationFragment vdf) {
    IVariableBinding vb = vdf.resolveBinding();
    if (vb.isField())
      return false;

    Expression initializer = vdf.getInitializer();
    if (initializer == null)
      return false;

    if (isNullLiteral(initializer))
      return false;

    if (!vb.getType().getErasure()
        .isEqualTo(initializer.resolveTypeBinding().getErasure())) {
      return false;
    }

    return true;
View Full Code Here


    List<VariableDeclarationFragment> fragments = node.fragments();

    int modifiers = node.getModifiers();
    if (TransformWriter.isAnySpecial(fragments)) {
      for (VariableDeclarationFragment f : fragments) {
        IVariableBinding vb = f.resolveBinding();
        boolean asMethod = TransformUtil.asMethod(vb);
        access = Header.printAccess(out, asMethod ? Modifier.PRIVATE
            : vb.getModifiers(), access);

        Object cv = TransformUtil.constexprValue(f);
        printi(TransformUtil.fieldModifiers(type, modifiers, true,
            cv != null));

        print(TransformUtil.varTypeCName(modifiers, vb.getType(), type,
            deps) + " ");

        f.accept(this);

        println(asMethod ? "_;" : ";");
View Full Code Here

    return false;
  }

  @Override
  public boolean visit(VariableDeclarationFragment node) {
    IVariableBinding vb = node.resolveBinding();
    ITypeBinding tb = vb.getType();
    header.field(vb);
    softDep(tb);

    node.getName().accept(this);
View Full Code Here

          IMethodBinding mb = (IMethodBinding) t;
          return mb.getName().equals(name);
        }

        if (t instanceof IVariableBinding) {
          IVariableBinding vb = (IVariableBinding) t;
          return vb.getName().equals(name);
        }

        return false;
      }
    };
View Full Code Here

  @Override
  public boolean visit(SimpleName node) {
    IBinding b = node.resolveBinding();
    if (b instanceof IVariableBinding) {
      IVariableBinding vb = (IVariableBinding) b;

      if (isClosure(node, vb)) {
        typeInfo.addClosure(vb);
      }
    }
View Full Code Here

      IBinding b = qualifier.resolveBinding();
      if (b instanceof ITypeBinding) {
        hardDep((ITypeBinding) b);
        print(CName.relative((ITypeBinding) b, type, true) + "::");
      } else if (b instanceof IVariableBinding) {
        IVariableBinding vb = (IVariableBinding) b;
        hardDep(vb.getType());

        boolean hidden = false;
        if (x instanceof IVariableBinding) {
          hidden = hidden(vb.getType(), (IVariableBinding) x);
        }

        if (hidden) {
          staticCast(qualifier.resolveTypeBinding(),
              ((IVariableBinding) x).getDeclaringClass());
View Full Code Here

  @Override
  public boolean visit(SimpleName node) {
    IBinding b = node.resolveBinding();

    if (b instanceof IVariableBinding) {
      IVariableBinding vb = (IVariableBinding) b;
      softDep(vb.getType());

      boolean qualified = false;
      if (needsQualification(node, vb.getDeclaringClass())) {
        qualify(vb.getDeclaringClass().getErasure(),
            TransformUtil.isStatic(vb));
        qualified = true;
      }

      boolean hidden = !qualified && unqualified(node)
          && hidden(scope(node), vb);

      if (node.getParent() instanceof SuperFieldAccess) {
        print("super::");
      } else if (hidden) {
        print(CName.relative(vb.getDeclaringClass(), type, true) + "::");
      }
     
      if (typeInfo.isClosure(vb)) {
        // Closures need a name resolved differently, to avoid method/
        // variable name conflicts which are allowed in Java but not
View Full Code Here

    IBinding b = node.resolveBinding();
    if (!(b instanceof IVariableBinding)) {
      return false;
    }

    IVariableBinding vb = (IVariableBinding) b;
    if (!Modifier.isVolatile(vb.getModifiers())) {
      return false;
    }

    ASTNode parent = node.getParent();
View Full Code Here

      if (node instanceof Name) {
        Name name = ((Name) node);
        IBinding b = name.resolveBinding();
        if (b instanceof IVariableBinding) {
          IVariableBinding vb = (IVariableBinding) b;
          castName(node, name, vb);
        }
      }
    }
View Full Code Here

  }

  @Override
  public boolean visit(FieldAccess node) {
    ITypeBinding tb = node.resolveTypeBinding();
    IVariableBinding vb = node.resolveFieldBinding();
    ITypeBinding tbe = vb.getVariableDeclaration().getType().getErasure();
    boolean cast = TransformUtil.variableErased(vb)
        && !isLeftHandSide(node);

    Expression expr = node.getExpression();

    boolean hidden = false;
    if (cast) {
      javaCast(tbe, tb);
    } else {
      hidden = hidden(expr.resolveTypeBinding(), vb);
    }

    if (hidden) {
      staticCast(tbe, vb.getDeclaringClass());
    }

    npcAccept(expr);
    hardDep(expr.resolveTypeBinding());
View Full Code Here

TOP

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

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.