markAsLinked(rewrite, newDecl.getType(), false, KEY_TYPE);
	private ASTRewrite doAddLocal(CompilationUnit cu) throws CoreException {		AST ast= cu.getAST();				SimpleName node= fOriginalNode;		BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(node);		if (decl instanceof MethodDeclaration || decl instanceof Initializer) {			ASTRewrite rewrite= new ASTRewrite(decl);								ASTNode parent= node.getParent();			if (parent.getNodeType() == ASTNode.ASSIGNMENT) {				Assignment assignment= (Assignment) parent;				if (node.equals(assignment.getLeftHandSide())) {					int parentParentKind= parent.getParent().getNodeType();					if (parentParentKind == ASTNode.EXPRESSION_STATEMENT) {												// x = 1; -> int x = 1;						VariableDeclarationFragment newDeclFrag= ast.newVariableDeclarationFragment();						VariableDeclarationStatement newDecl= ast.newVariableDeclarationStatement(newDeclFrag);						newDecl.setType(evaluateVariableType(ast));												Expression placeholder= (Expression) rewrite.createCopy(assignment.getRightHandSide());						newDeclFrag.setInitializer(placeholder);						newDeclFrag.setName(ast.newSimpleName(node.getIdentifier()));						rewrite.markAsReplaced(assignment.getParent(), newDecl);												markAsLinked(rewrite, newDeclFrag.getName(), true, KEY_NAME);						markAsLinked(rewrite, newDecl.getType(), false, KEY_TYPE);						return rewrite;					} else if (parentParentKind == ASTNode.FOR_STATEMENT) {						//	for (x = 1;;) ->for (int x = 1;;)												ForStatement forStatement= (ForStatement) parent.getParent();						if (forStatement.initializers().size() == 1 && assignment.equals(forStatement.initializers().get(0))) {							VariableDeclarationFragment frag= ast.newVariableDeclarationFragment();							VariableDeclarationExpression expression= ast.newVariableDeclarationExpression(frag);							frag.setName(ast.newSimpleName(node.getIdentifier()));							Expression placeholder= (Expression) rewrite.createCopy(assignment.getRightHandSide());							frag.setInitializer(placeholder);							expression.setType(evaluateVariableType(ast));														rewrite.markAsReplaced(assignment, expression);														markAsLinked(rewrite, frag.getName(), true, KEY_NAME); 							markAsLinked(rewrite, expression.getType(), false, KEY_TYPE); 														return rewrite;						}								}							}			}			//	foo(x) -> int x= 0; foo(x)						VariableDeclarationFragment newDeclFrag= ast.newVariableDeclarationFragment();			VariableDeclarationStatement newDecl= ast.newVariableDeclarationStatement(newDeclFrag);			newDeclFrag.setName(ast.newSimpleName(node.getIdentifier()));			newDecl.setType(evaluateVariableType(ast));			newDeclFrag.setInitializer(ASTNodeFactory.newDefaultExpression(ast, newDecl.getType(), 0));			markAsLinked(rewrite, node, true, KEY_NAME); 			markAsLinked(rewrite, newDecl.getType(), false, KEY_TYPE);			markAsLinked(rewrite, newDeclFrag.getName(), false, KEY_NAME);			Statement statement= ASTResolving.findParentStatement(node);			if (statement != null) {				List list= ASTNodes.getContainingList(statement);				while (list == null && statement.getParent() instanceof Statement) { // parent must be if, for or while					statement= (Statement) statement.getParent();					list= ASTNodes.getContainingList(statement);				}				if (list != null) {					list.add(list.indexOf(statement), newDecl);					rewrite.markAsInserted(newDecl);					return rewrite;									}			}		}		return null;	}