Write KotlinSyntheticClass to generated classes for functions

That is SAM wrappers, callable reference wrappers, local functions and
anonymous functions
This commit is contained in:
Alexander Udalov
2014-03-05 18:07:54 +04:00
parent 8e71fe376f
commit cbfb626d50
10 changed files with 180 additions and 101 deletions
@@ -22,6 +22,7 @@ import org.jetbrains.jet.lang.resolve.kotlin.KotlinBinaryClassCache
import org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader
import org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader.Kind
import com.intellij.psi.ClassFileViewProvider
import org.jetbrains.jet.lang.resolve.java.JvmAnnotationNames.KotlinSyntheticClass
//TODO: this should be done via generic mechanism (special header kind)
@@ -47,7 +48,7 @@ public fun isKotlinCompiledFile(file: VirtualFile): Boolean {
return false
}
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file).getClassHeader()
return header != null && header.getKind() != KotlinClassHeader.Kind.TRAIT_IMPL
return header != null && header.getSyntheticClassKind() != KotlinSyntheticClass.Kind.TRAIT_IMPL
}
public fun isKotlinCompiledFileWithIncompatibleAbiVersion(file: VirtualFile): Boolean {
@@ -69,5 +70,5 @@ public fun isKotlinInternalCompiledFile(file: VirtualFile): Boolean {
return true
}
val header = KotlinBinaryClassCache.getKotlinBinaryClass(file).getClassHeader()
return header?.getKind() == KotlinClassHeader.Kind.PACKAGE_PART
}
return header?.getKind() == KotlinClassHeader.Kind.SYNTHETIC_CLASS
}