/** * Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings * * @param node * @param dimensions * @deprecated */ private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) { node.setExtraDimensions(dimensions); } /**
/** * Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings * * @param node * @param dimensions * @deprecated */ private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) { node.setExtraDimensions(dimensions); } /**
/** * Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings * * @param node * @param dimensions * @deprecated */ private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) { node.setExtraDimensions(dimensions); } /**
/** * Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings * * @param node * @param dimensions * @deprecated */ private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) { node.setExtraDimensions(dimensions); } /**
/** * Internal access method to SingleVariableDeclaration#setExtraDimensions() for avoiding deprecated warnings * * @param node * @param dimensions * @deprecated */ private static void internalSetExtraDimensions(SingleVariableDeclaration node, int dimensions) { node.setExtraDimensions(dimensions); } /**
final int internalGetSetIntProperty(SimplePropertyDescriptor property, boolean get, int value) { if (property == MODIFIERS_PROPERTY) { if (get) { return getModifiers(); } else { setModifiers(value); return 0; } } if (property == EXTRA_DIMENSIONS_PROPERTY) { if (get) { return getExtraDimensions(); } else { setExtraDimensions(value); return 0; } } // allow default implementation to flag the error return super.internalGetSetIntProperty(property, get, value); }
private SingleVariableDeclaration newParameterDeclaration(AST ast, ImportRewrite importRewrite, String paramName, ITypeBinding paramType) { SingleVariableDeclaration param= ast.newSingleVariableDeclaration(); param.setExtraDimensions(0); param.setInitializer(null); param.setType(importRewrite.addImport(paramType, ast)); param.setName(ast.newSimpleName(paramName)); return param; }
@Override public boolean visit(SingleVariableDeclaration node) { AST ast = node.getAST(); if (node.getExtraDimensions() > 0) { Type type = (Type) ASTNode.copySubtree(ast, node.getType()); for (int i = node.getExtraDimensions(); i > 0; i--) { type = ast.newArrayType(type); } node.setType(type); node.setExtraDimensions(0); } return true; } }
protected SingleVariableDeclaration convertToSingleVariableDeclaration(LocalDeclaration localDeclaration) { final SingleVariableDeclaration variableDecl = new SingleVariableDeclaration(this.ast); setModifiers(variableDecl, localDeclaration); final SimpleName name = new SimpleName(this.ast); name.internalSetIdentifier(new String(localDeclaration.name)); int start = localDeclaration.sourceStart; int nameEnd = localDeclaration.sourceEnd; name.setSourceRange(start, nameEnd - start + 1); variableDecl.setName(name); final int extraDimensions = retrieveExtraDimension(nameEnd + 1, localDeclaration.type.sourceEnd); variableDecl.setExtraDimensions(extraDimensions); Type type = convertType(localDeclaration.type); int typeEnd = type.getStartPosition() + type.getLength() - 1; int rightEnd = Math.max(typeEnd, localDeclaration.declarationSourceEnd); /* * There is extra work to do to set the proper type positions * See PR http://bugs.eclipse.org/bugs/show_bug.cgi?id=23284 */ setTypeForSingleVariableDeclaration(variableDecl, type, extraDimensions); variableDecl.setSourceRange(localDeclaration.declarationSourceStart, rightEnd - localDeclaration.declarationSourceStart + 1); if (this.resolveBindings) { recordNodes(name, localDeclaration); recordNodes(variableDecl, localDeclaration); variableDecl.resolveBinding(); } return variableDecl; }
ASTNode clone0(AST target) { SingleVariableDeclaration result = new SingleVariableDeclaration(target); result.setSourceRange(getStartPosition(), getLength()); if (this.ast.apiLevel == AST.JLS2_INTERNAL) { result.setModifiers(getModifiers()); } else { result.modifiers().addAll(ASTNode.copySubtrees(target, modifiers())); result.setVarargs(isVarargs()); } result.setType((Type) getType().clone(target)); result.setExtraDimensions(getExtraDimensions()); result.setName((SimpleName) getName().clone(target)); result.setInitializer( (Expression) ASTNode.copySubtree(target, getInitializer())); return result; }
final int typeSourceEnd = argument.type.sourceEnd; final int extraDimensions = retrieveExtraDimension(nameEnd + 1, typeSourceEnd); variableDecl.setExtraDimensions(extraDimensions); final boolean isVarArgs = argument.isVarArgs(); if (isVarArgs && extraDimensions == 0) {