Make JetExpressionCodeFragmentImpl implement JavaCodeFragment
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<root>
|
||||
<item name='com.intellij.psi.JavaCodeFragment java.lang.String importsToString()'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
<item name='com.intellij.psi.JavaPsiFacade com.intellij.psi.JavaPsiFacade getInstance(com.intellij.openapi.project.Project)'>
|
||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||
</item>
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
package org.jetbrains.jet.lang.psi;
|
||||
|
||||
import com.intellij.psi.PsiCodeFragment;
|
||||
import com.intellij.psi.JavaCodeFragment;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface JetExpressionCodeFragment extends PsiCodeFragment {
|
||||
public interface JetExpressionCodeFragment extends JavaCodeFragment {
|
||||
@Nullable
|
||||
JetExpression getExpression();
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@ package org.jetbrains.jet.lang.psi
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.psi.PsiElement
|
||||
import org.jetbrains.annotations.Nullable
|
||||
import org.jetbrains.jet.JetNodeTypes
|
||||
import com.intellij.psi.JavaCodeFragment
|
||||
import com.intellij.psi.PsiType
|
||||
import com.intellij.psi.PsiClass
|
||||
|
||||
class JetExpressionCodeFragmentImpl(
|
||||
project: Project,
|
||||
@@ -28,5 +30,52 @@ class JetExpressionCodeFragmentImpl(
|
||||
context: PsiElement?
|
||||
) : JetCodeFragmentImpl(project, name, text, JetNodeTypes.EXPRESSION_CODE_FRAGMENT, context), JetExpressionCodeFragment {
|
||||
|
||||
private var _thisType: PsiType? = null
|
||||
private var _superType: PsiType? = null
|
||||
private var _exceptionHandler: JavaCodeFragment.ExceptionHandler? = null
|
||||
|
||||
private val myImports: MutableSet<String> = hashSetOf()
|
||||
|
||||
override fun getThisType() = _thisType
|
||||
|
||||
override fun setThisType(psiType: PsiType?) {
|
||||
_thisType = psiType
|
||||
}
|
||||
|
||||
override fun getSuperType() = _superType
|
||||
|
||||
override fun setSuperType(superType: PsiType?) {
|
||||
_superType = superType
|
||||
}
|
||||
|
||||
override fun importsToString(): String {
|
||||
return myImports.makeString(IMPORT_SEPARATOR)
|
||||
}
|
||||
|
||||
override fun addImportsFromString(imports: String?) {
|
||||
if (imports == null) return
|
||||
|
||||
myImports.addAll(imports.split(IMPORT_SEPARATOR))
|
||||
}
|
||||
|
||||
override fun setVisibilityChecker(checker: JavaCodeFragment.VisibilityChecker?) {
|
||||
}
|
||||
|
||||
override fun getVisibilityChecker() = JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE
|
||||
|
||||
override fun setExceptionHandler(checker: JavaCodeFragment.ExceptionHandler?) {
|
||||
_exceptionHandler = checker
|
||||
}
|
||||
|
||||
override fun getExceptionHandler() = _exceptionHandler
|
||||
|
||||
override fun importClass(aClass: PsiClass?): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun getExpression() = findChildByClass(javaClass<JetExpression>())
|
||||
|
||||
class object {
|
||||
val IMPORT_SEPARATOR = ","
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user