From 1592e649d75d41c9a55762eba83bf7185d891c86 Mon Sep 17 00:00:00 2001 From: "Pavel V. Talanov" Date: Wed, 26 Mar 2014 16:24:20 +0400 Subject: [PATCH] Add PsiJetFunctionStub#hasBlockBody() --- .../lang/psi/stubs/PsiJetFunctionStub.java | 9 ++------- .../elements/JetFunctionElementType.java | 7 +++++-- .../stubs/impl/PsiJetFunctionStubImpl.java | 19 ++++++++++++++++--- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetFunctionStub.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetFunctionStub.java index cb17f51a2e8..df6ea547d2a 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetFunctionStub.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/PsiJetFunctionStub.java @@ -20,17 +20,12 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.jet.lang.psi.JetNamedFunction; public interface PsiJetFunctionStub extends PsiJetStubWithFqName { - /** - * Is function defined in directly in package. - * @return - */ boolean isTopLevel(); - /** - * Does function extends some type. - */ boolean isExtension(); + boolean hasBlockBody(); + @NotNull String[] getAnnotations(); } diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java index e6422861299..4d09ceb8a29 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/psi/stubs/elements/JetFunctionElementType.java @@ -55,7 +55,8 @@ public class JetFunctionElementType extends JetStubElementType implement private final boolean isTopLevel; private final boolean isExtension; private final FqName fqName; + private final boolean hasBlockBody; public PsiJetFunctionStubImpl( @NotNull StubElement parent, @Nullable String name, boolean isTopLevel, @Nullable FqName fqName, - boolean isExtension + boolean isExtension, + boolean hasBlockBody ) { - this(parent, StringRef.fromString(name), isTopLevel, fqName, isExtension); + this(parent, StringRef.fromString(name), isTopLevel, fqName, isExtension, hasBlockBody); } public PsiJetFunctionStubImpl( @@ -49,7 +51,8 @@ public class PsiJetFunctionStubImpl extends StubBase implement @Nullable StringRef nameRef, boolean isTopLevel, @Nullable FqName fqName, - boolean isExtension + boolean isExtension, + boolean hasBlockBody ) { super(parent, JetStubElementTypes.FUNCTION); @@ -61,6 +64,7 @@ public class PsiJetFunctionStubImpl extends StubBase implement this.fqName = fqName; this.isTopLevel = isTopLevel; this.isExtension = isExtension; + this.hasBlockBody = hasBlockBody; } @Override @@ -78,6 +82,11 @@ public class PsiJetFunctionStubImpl extends StubBase implement return isExtension; } + @Override + public boolean hasBlockBody() { + return hasBlockBody; + } + @NotNull @Override public String[] getAnnotations() { @@ -99,6 +108,10 @@ public class PsiJetFunctionStubImpl extends StubBase implement builder.append("ext "); } + if (!hasBlockBody) { + builder.append("no block body "); + } + builder.append("name=").append(getName()); builder.append("]");