Java Code Examples for org.eclipse.jdt.core.dom.Expression#getProperty()
The following examples show how to use
org.eclipse.jdt.core.dom.Expression#getProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final void endVisit(final ArrayInitializer node) { final ITypeBinding binding= node.resolveTypeBinding(); if (binding != null && binding.isArray()) { final ConstraintVariable2 ancestor= fModel.createIndependentTypeVariable(binding.getElementType()); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); Expression expression= null; ConstraintVariable2 descendant= null; final List<Expression> expressions= node.expressions(); for (int index= 0; index < expressions.size(); index++) { expression= expressions.get(index); descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) fModel.createSubtypeConstraint(descendant, ancestor); } } } }
Example 2
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final void endVisit(final ConditionalExpression node) { ConstraintVariable2 thenVariable= null; ConstraintVariable2 elseVariable= null; final Expression thenExpression= node.getThenExpression(); if (thenExpression != null) thenVariable= (ConstraintVariable2) thenExpression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); final Expression elseExpression= node.getElseExpression(); if (elseExpression != null) elseVariable= (ConstraintVariable2) elseExpression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); ITypeBinding binding= node.resolveTypeBinding(); if (binding != null) { if (binding.isArray()) binding= binding.getElementType(); final ConstraintVariable2 ancestor= fModel.createIndependentTypeVariable(binding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); if (thenVariable != null) fModel.createSubtypeConstraint(thenVariable, ancestor); if (elseVariable != null) fModel.createSubtypeConstraint(elseVariable, ancestor); if (thenVariable != null && elseVariable != null) fModel.createConditionalTypeConstraint(ancestor, thenVariable, elseVariable); } } }
Example 3
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
/** * End of visit the field access. * * @param binding the variable binding * @param qualifier the qualifier expression, or <code>null</code> * @param access the access expression */ private void endVisit(final IVariableBinding binding, final Expression qualifier, final Expression access) { access.setProperty(PROPERTY_CONSTRAINT_VARIABLE, fModel.createVariableVariable(binding)); if (qualifier != null) { final ITypeBinding type= binding.getDeclaringClass(); if (type != null) { // array.length does not have a declaring class final ConstraintVariable2 ancestor= fModel.createDeclaringTypeVariable(type); if (ancestor != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) qualifier.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) fModel.createSubtypeConstraint(descendant, ancestor); } } } }
Example 4
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public final void endVisit(final ReturnStatement node) { final Expression expression= node.getExpression(); if (expression != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) { final MethodDeclaration declaration= fCurrentMethods.peek(); if (declaration != null) { final IMethodBinding binding= declaration.resolveBinding(); if (binding != null) { final ConstraintVariable2 ancestor= fModel.createReturnTypeVariable(binding); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); fModel.createSubtypeConstraint(descendant, ancestor); } } } } } }
Example 5
Source File: BaseTranslator.java From junion with BSD 3-Clause "New" or "Revised" License | 5 votes |
public StructCache.Entry entry(Expression name) { if(name instanceof Name) return entry((Name)name); Object o = name.getProperty(TYPEBIND_PROP); if(o instanceof StructCache.FieldType) return null; Entry e = (Entry)o; if(e != null) return e; return StructCache.get(name); }
Example 6
Source File: BaseTranslator.java From junion with BSD 3-Clause "New" or "Revised" License | 5 votes |
public ParenthesizedExpression wrap(Expression e) { ParenthesizedExpression p = ast.newParenthesizedExpression(); p.setExpression(e); Object o = e.getProperty(TYPEBIND_PROP); if(o != null) p.setProperty(TYPEBIND_PROP, o); return p; }
Example 7
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * End of visit the method argument list. * * @param arguments the arguments (element type: <code>Expression</code>) * @param binding the method binding */ private void endVisit(final List<Expression> arguments, final IMethodBinding binding) { Expression expression= null; ConstraintVariable2 ancestor= null; ConstraintVariable2 descendant= null; for (int index= 0; index < arguments.size(); index++) { expression= arguments.get(index); descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); ancestor= fModel.createMethodParameterVariable(binding, index); if (ancestor != null && descendant != null) fModel.createSubtypeConstraint(descendant, ancestor); } }
Example 8
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public final void endVisit(final MethodInvocation node) { final IMethodBinding binding= node.resolveMethodBinding(); if (binding != null) { endVisit(node, binding); endVisit(node.arguments(), binding); final Expression expression= node.getExpression(); if (expression != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) endVisit(binding, descendant); } } }
Example 9
Source File: SuperTypeConstraintsCreator.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
@Override public final void endVisit(final SingleVariableDeclaration node) { final ConstraintVariable2 ancestor= (ConstraintVariable2) node.getType().getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (ancestor != null) { node.setProperty(PROPERTY_CONSTRAINT_VARIABLE, ancestor); final Expression expression= node.getInitializer(); if (expression != null) { final ConstraintVariable2 descendant= (ConstraintVariable2) expression.getProperty(PROPERTY_CONSTRAINT_VARIABLE); if (descendant != null) fModel.createSubtypeConstraint(descendant, ancestor); } } }