use of org.eclipse.jdt.core.dom.IVariableBinding in project che by eclipse.
the class FullConstraintCreator method create.
/* (non-Javadoc)
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.FieldAccess)
*/
@Override
public ITypeConstraint[] create(FieldAccess access) {
Expression expression = access.getExpression();
SimpleName name = access.getName();
IBinding binding = name.resolveBinding();
if (!(binding instanceof IVariableBinding))
return new ITypeConstraint[0];
IVariableBinding vb = (IVariableBinding) binding;
return createConstraintsForAccessToField(vb, expression, access);
}
use of org.eclipse.jdt.core.dom.IVariableBinding in project che by eclipse.
the class FullConstraintCreator method create.
/* (non-Javadoc)
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.QualifiedName)
*/
@Override
public ITypeConstraint[] create(QualifiedName qualifiedName) {
SimpleName name = qualifiedName.getName();
Name qualifier = qualifiedName.getQualifier();
IBinding nameBinding = name.resolveBinding();
if (nameBinding instanceof IVariableBinding) {
IVariableBinding vb = (IVariableBinding) nameBinding;
if (vb.isField())
return createConstraintsForAccessToField(vb, qualifier, qualifiedName);
}
//TODO other bindings
return new ITypeConstraint[0];
}
use of org.eclipse.jdt.core.dom.IVariableBinding in project che by eclipse.
the class FullConstraintCreator method create.
/* (non-Javadoc)
* @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.SuperFieldAccess)
*/
@Override
public ITypeConstraint[] create(SuperFieldAccess access) {
SimpleName name = access.getName();
IBinding binding = name.resolveBinding();
if (!(binding instanceof IVariableBinding))
return new ITypeConstraint[0];
IVariableBinding vb = (IVariableBinding) binding;
return createConstraintsForAccessToField(vb, null, access);
}
use of org.eclipse.jdt.core.dom.IVariableBinding in project che by eclipse.
the class FullConstraintCreator method getConstraintsForHiding.
private Collection<ITypeConstraint> getConstraintsForHiding(VariableDeclarationFragment fragment) {
Collection<ITypeConstraint> result = new ArrayList<ITypeConstraint>();
IVariableBinding fieldBinding = fragment.resolveBinding();
Assert.isTrue(fieldBinding.isField());
Set<ITypeBinding> declaringTypes = getDeclaringSuperTypes(fieldBinding);
ConstraintVariable hiddingFieldVar = fConstraintVariableFactory.makeDeclaringTypeVariable(fieldBinding);
for (Iterator<ITypeBinding> iter = declaringTypes.iterator(); iter.hasNext(); ) {
ITypeBinding declaringSuperType = iter.next();
IVariableBinding hiddenField = findField(fieldBinding, declaringSuperType);
Assert.isTrue(hiddenField.isField());
ConstraintVariable hiddenFieldVar = fConstraintVariableFactory.makeDeclaringTypeVariable(hiddenField);
result.addAll(Arrays.asList(fTypeConstraintFactory.createStrictSubtypeConstraint(hiddingFieldVar, hiddenFieldVar)));
}
return result;
}
use of org.eclipse.jdt.core.dom.IVariableBinding in project che by eclipse.
the class LocalDeclarationAnalyzer method visit.
@Override
public boolean visit(SimpleName node) {
IVariableBinding binding = null;
if (node.isDeclaration() || !considerNode(node) || (binding = ASTNodes.getLocalVariableBinding(node)) == null)
return false;
handleReferenceToLocal(node, binding);
return true;
}
Aggregations