TreeElement (TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { if (first == last && first.getElementType() == JavaElementType.MODULE_REFERENCE && anchor == null) { ASTNode lastChild = getLastChildNode(), addAfter = lastChild; if (lastChild.getElementType() == JavaTokenType.SEMICOLON || lastChild.getElementType() == TokenType.ERROR_ELEMENT) { addAfter = lastChild.getTreePrev(); lastChild = PsiImplUtil.skipWhitespaceAndCommentsBack(addAfter); } if (lastChild != null) { CharTable charTable = SharedImplUtil.findCharTableByTree(this); if (lastChild.getElementType() == JavaElementType.JAVA_CODE_REFERENCE) { LeafElement to = Factory.createSingleLeafElement(JavaTokenType.TO_KEYWORD, PsiKeyword.TO, charTable, getManager()); anchor = super.addInternal(to, to, addAfter, Boolean.FALSE); before = Boolean.FALSE; } else if (lastChild.getElementType() == JavaElementType.MODULE_REFERENCE) { LeafElement comma = Factory.createSingleLeafElement(JavaTokenType.COMMA, ",", charTable, getManager()); anchor = super.addInternal(comma, comma, addAfter, Boolean.FALSE); before = Boolean.FALSE; } } } return super.addInternal(first, last, anchor, before); }