More correct code transformations: do not perform formatter's job on yourself

This commit is contained in:
Valentin Kipyatkov
2014-01-23 16:57:56 +04:00
parent ab7d8a7734
commit 3028cec4cd
10 changed files with 58 additions and 22 deletions
@@ -95,24 +95,19 @@ public class JetPsiFactory {
return comma;
}
//the pair contains the first and the last elements of a range
@NotNull
public static Pair<PsiElement, PsiElement> createColonAndWhiteSpaces(Project project) {
JetProperty property = createProperty(project, "val x : Int");
return Pair.create(property.findElementAt(5), property.findElementAt(7));
}
//the pair contains the first and the last elements of a range
@NotNull
public static Pair<PsiElement, PsiElement> createTypeWhiteSpaceAndColon(Project project, String type) {
JetProperty property = createProperty(project, "val x: " + type);
return Pair.create(property.findElementAt(5), (PsiElement) property.getTypeRef());
public static PsiElement createEQ(Project project) {
PsiElement eq = createFunction(project, "fun foo() = foo").getEqualsToken();
assert eq != null;
return eq;
}
@NotNull
public static ASTNode createColonNode(Project project) {
public static PsiElement createColon(Project project) {
JetProperty property = createProperty(project, "val x: Int");
return property.getNode().findChildByType(JetTokens.COLON);
PsiElement colon = property.findElementAt(5);
assert colon != null;
return colon;
}
@NotNull