Remove interface for JetExpressionCodeFragment
This commit is contained in:
@@ -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();
|
|
||||||
}
|
|
||||||
|
|
||||||
+3
-3
@@ -23,12 +23,12 @@ import com.intellij.psi.JavaCodeFragment
|
|||||||
import com.intellij.psi.PsiType
|
import com.intellij.psi.PsiType
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
|
|
||||||
class JetExpressionCodeFragmentImpl(
|
public class JetExpressionCodeFragment(
|
||||||
project: Project,
|
project: Project,
|
||||||
name: String,
|
name: String,
|
||||||
text: CharSequence,
|
text: CharSequence,
|
||||||
context: PsiElement?
|
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 _thisType: PsiType? = null
|
||||||
private var _superType: PsiType? = null
|
private var _superType: PsiType? = null
|
||||||
@@ -73,7 +73,7 @@ class JetExpressionCodeFragmentImpl(
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getExpression(): JetExpression? {
|
fun getExpression(): JetExpression? {
|
||||||
var resultingExpression: JetExpression? = null
|
var resultingExpression: JetExpression? = null
|
||||||
this.accept(object: JetTreeVisitor<Void>() {
|
this.accept(object: JetTreeVisitor<Void>() {
|
||||||
override fun visitExpression(expression: JetExpression, data: Void?): Void? {
|
override fun visitExpression(expression: JetExpression, data: Void?): Void? {
|
||||||
@@ -339,7 +339,7 @@ public class JetPsiFactory {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public static JetExpressionCodeFragment createExpressionCodeFragment(Project project, String text, PsiElement context) {
|
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
|
@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.JetSimpleNameExpression
|
||||||
import org.jetbrains.jet.lang.psi.JetOperationExpression
|
import org.jetbrains.jet.lang.psi.JetOperationExpression
|
||||||
import org.jetbrains.jet.lang.psi.JetExpression
|
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
|
import org.jetbrains.jet.lang.psi.JetSuperExpression
|
||||||
|
|
||||||
class KotlinEditorTextProvider : EditorTextProvider {
|
class KotlinEditorTextProvider : EditorTextProvider {
|
||||||
@@ -55,7 +55,7 @@ class KotlinEditorTextProvider : EditorTextProvider {
|
|||||||
|
|
||||||
return containingFile.getImportList()?.getImports()
|
return containingFile.getImportList()?.getImports()
|
||||||
?.map { it.getText() }
|
?.map { it.getText() }
|
||||||
?.makeString(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR) ?: ""
|
?.makeString(JetExpressionCodeFragment.IMPORT_SEPARATOR) ?: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
fun findExpressionInner(element: PsiElement): JetExpression? {
|
fun findExpressionInner(element: PsiElement): JetExpression? {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiElement
|
|||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.psi.JavaCodeFragment
|
import com.intellij.psi.JavaCodeFragment
|
||||||
import org.jetbrains.jet.plugin.JetFileType
|
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.psi.PsiCodeBlock
|
||||||
import com.intellij.debugger.engine.evaluation.CodeFragmentKind
|
import com.intellij.debugger.engine.evaluation.CodeFragmentKind
|
||||||
import com.intellij.psi.JavaCodeFragmentFactory
|
import com.intellij.psi.JavaCodeFragmentFactory
|
||||||
@@ -33,7 +33,7 @@ import org.jetbrains.jet.lang.psi.JetExpression
|
|||||||
class KotlinCodeFragmentFactory: CodeFragmentFactory() {
|
class KotlinCodeFragmentFactory: CodeFragmentFactory() {
|
||||||
override fun createCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment {
|
override fun createCodeFragment(item: TextWithImports, context: PsiElement?, project: Project): JavaCodeFragment {
|
||||||
if (item.getKind() == CodeFragmentKind.EXPRESSION) {
|
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()) {
|
if (item.getImports().isNotEmpty()) {
|
||||||
codeFragment.addImportsFromString(item.getImports())
|
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.plugin.codeInsight.CodeInsightUtils
|
||||||
import org.jetbrains.jet.OutputFileCollection
|
import org.jetbrains.jet.OutputFileCollection
|
||||||
import org.jetbrains.jet.lang.psi.JetExpressionCodeFragment
|
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
|
import org.jetbrains.jet.plugin.caches.resolve.getAnalysisResults
|
||||||
|
|
||||||
object KotlinEvaluationBuilder: EvaluatorBuilder {
|
object KotlinEvaluationBuilder: EvaluatorBuilder {
|
||||||
@@ -222,7 +222,7 @@ private fun createFileForDebugger(codeFragment: JetExpressionCodeFragment,
|
|||||||
): JetFile {
|
): JetFile {
|
||||||
var fileText = template.replace("!IMPORT_LIST!",
|
var fileText = template.replace("!IMPORT_LIST!",
|
||||||
codeFragment.importsToString()
|
codeFragment.importsToString()
|
||||||
.split(JetExpressionCodeFragmentImpl.IMPORT_SEPARATOR)
|
.split(JetExpressionCodeFragment.IMPORT_SEPARATOR)
|
||||||
.makeString("\n"))
|
.makeString("\n"))
|
||||||
|
|
||||||
fileText = fileText.replace("!FUNCTION!", extractedFunction.getText())
|
fileText = fileText.replace("!FUNCTION!", extractedFunction.getText())
|
||||||
|
|||||||
Reference in New Issue
Block a user