Remove interface for JetExpressionCodeFragment

This commit is contained in:
Natalia Ukhorskaya
2014-04-24 17:15:27 +04:00
parent 429be58685
commit eb8b5c0823
6 changed files with 10 additions and 36 deletions
@@ -1,26 +0,0 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.jet.lang.psi;
import com.intellij.psi.JavaCodeFragment;
import org.jetbrains.annotations.Nullable;
public interface JetExpressionCodeFragment extends JavaCodeFragment {
@Nullable
JetExpression getExpression();
}
@@ -23,12 +23,12 @@ import com.intellij.psi.JavaCodeFragment
import com.intellij.psi.PsiType
import com.intellij.psi.PsiClass
class JetExpressionCodeFragmentImpl(
public class JetExpressionCodeFragment(
project: Project,
name: String,
text: CharSequence,
context: PsiElement?
) : JetCodeFragment(project, name, text, JetNodeTypes.EXPRESSION_CODE_FRAGMENT, context), JetExpressionCodeFragment {
) : JetCodeFragment(project, name, text, JetNodeTypes.EXPRESSION_CODE_FRAGMENT, context), JavaCodeFragment {
private var _thisType: PsiType? = null
private var _superType: PsiType? = null
@@ -73,7 +73,7 @@ class JetExpressionCodeFragmentImpl(
return true
}
override fun getExpression(): JetExpression? {
fun getExpression(): JetExpression? {
var resultingExpression: JetExpression? = null
this.accept(object: JetTreeVisitor<Void>() {
override fun visitExpression(expression: JetExpression, data: Void?): Void? {
@@ -339,7 +339,7 @@ public class JetPsiFactory {
@NotNull
public static JetExpressionCodeFragment createExpressionCodeFragment(Project project, String text, PsiElement context) {
return new JetExpressionCodeFragmentImpl(project, "fragment.kt", text, context);
return new JetExpressionCodeFragment(project, "fragment.kt", text, context);
}
@NotNull
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.psi.JetThisExpression
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression
import org.jetbrains.jet.lang.psi.JetOperationExpression
import org.jetbrains.jet.lang.psi.JetExpression
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment
import org.jetbrains.jet.lang.psi.JetSuperExpression
class KotlinEditorTextProvider : EditorTextProvider {
@@ -55,7 +55,7 @@ class KotlinEditorTextProvider : EditorTextProvider {
return containingFile.getImportList()?.getImports()
?.map { it.getText() }
?.makeString(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR) ?: ""
?.makeString(JetExpressionCodeFragment.IMPORT_SEPARATOR) ?: ""
}
fun findExpressionInner(element: PsiElement): JetExpression? {
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement
import com.intellij.openapi.project.Project
import com.intellij.psi.JavaCodeFragment
import org.jetbrains.jet.plugin.JetFileType
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment
import com.intellij.psi.PsiCodeBlock
import com.intellij.debugger.engine.evaluation.CodeFragmentKind
import com.intellij.psi.JavaCodeFragmentFactory
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.psi.JetExpression
class KotlinCodeFragmentFactory: CodeFragmentFactory() {
override fun createCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment {
if (item.getKind() == CodeFragmentKind.EXPRESSION) {
val codeFragment = JetExpressionCodeFragmentImpl(project, "fragment.kt", item.getText(), getContextElement(context))
val codeFragment = JetExpressionCodeFragment(project, "fragment.kt", item.getText(), getContextElement(context))
if (item.getImports().isNotEmpty()) {
codeFragment.addImportsFromString(item.getImports())
}
@@ -63,7 +63,7 @@ import org.jetbrains.jet.codegen.ClassFileFactory
import org.jetbrains.jet.plugin.codeInsight.CodeInsightUtils
import org.jetbrains.jet.OutputFileCollection
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragmentImpl
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment
import org.jetbrains.jet.plugin.caches.resolve.getAnalysisResults
object KotlinEvaluationBuilder: EvaluatorBuilder {
@@ -222,7 +222,7 @@ private fun createFileForDebugger(codeFragment: JetExpressionCodeFragment,
): JetFile {
var fileText = template.replace("!IMPORT_LIST!",
codeFragment.importsToString()
.split(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR)
.split(JetExpressionCodeFragment.IMPORT_SEPARATOR)
.makeString("\n"))
fileText = fileText.replace("!FUNCTION!", extractedFunction.getText())