/*
   * Must be one of:
   * <ul>
   * <li>[result]= 0</li>
   * </ul>
   */
  private IVariableBinding getIndexBindingFromFragment(VariableDeclarationFragment fragment) {
    Expression initializer = fragment.getInitializer();
    if (!(initializer instanceof NumberLiteral)) return null;

    NumberLiteral number = (NumberLiteral) initializer;
    if (!LITERAL_0.equals(number.getToken())) return null;

    return (IVariableBinding) fragment.getName().resolveBinding();
  }
 private static Expression createInfixInvocationFromPostPrefixExpression(
     InfixExpression.Operator operator,
     Expression getterExpression,
     AST ast,
     ITypeBinding variableType,
     boolean is50OrHigher) {
   InfixExpression infix = ast.newInfixExpression();
   infix.setLeftOperand(getterExpression);
   infix.setOperator(operator);
   NumberLiteral number = ast.newNumberLiteral();
   number.setToken("1"); // $NON-NLS-1$
   infix.setRightOperand(number);
   ITypeBinding infixType = infix.resolveTypeBinding();
   return createNarrowCastIfNessecary(infix, infixType, ast, variableType, is50OrHigher);
 }
 /*
  * @see ASTVisitor#visit(NumberLiteral)
  */
 public boolean visit(NumberLiteral node) {
   this.fBuffer.append(node.getToken());
   return false;
 }
 /* (non-Javadoc)
  * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.NumberLiteral)
  */
 public boolean visit(NumberLiteral node) {
   PTNumberLiteral nl = InstantiationFactory.eINSTANCE.createPTNumberLiteral();
   nl.setToken(node.getToken());
   expression = nl;
   return false;
 }
  private boolean isOneLiteral(Expression expression) {
    if (!(expression instanceof NumberLiteral)) return false;

    NumberLiteral literal = (NumberLiteral) expression;
    return LITERAL_1.equals(literal.getToken());
  }
Example #6
0
 @Override
 public void endVisit(NumberLiteral node) {
   expressions.push(new VMNumberLiteral(node, node.getToken()));
 }