From cc008898485627a805c8275dede9883529712cb9 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Fri, 11 Jul 2014 20:07:35 +0400 Subject: Process properties in classes without accessors --- src/CompilerAPI.kt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/CompilerAPI.kt') diff --git a/src/CompilerAPI.kt b/src/CompilerAPI.kt index 756cd915..3429aeae 100644 --- a/src/CompilerAPI.kt +++ b/src/CompilerAPI.kt @@ -12,6 +12,7 @@ import com.intellij.psi.* import org.jetbrains.jet.lang.resolve.* import org.jetbrains.jet.lang.psi.* import org.jetbrains.jet.analyzer.* +import org.jetbrains.jet.lang.descriptors.* private fun getAnnotationsPath(paths: KotlinPaths, arguments: K2JVMCompilerArguments): MutableList { val annotationsPath = arrayListOf() @@ -51,3 +52,11 @@ private fun JetCoreEnvironment.analyze(messageCollector: MessageCollector): Bind fun AnalyzerWithCompilerReport.analyzeAndReport(files: List, analyser: () -> AnalyzeExhaust) = analyzeAndReport(analyser, files) fun BindingContext.getPackageFragment(file: JetFile) = get(BindingContext.FILE_TO_PACKAGE_FRAGMENT, file) + +fun DeclarationDescriptor.isUserCode() = + when (this) { + is PackageFragmentDescriptor -> false + is PropertyAccessorDescriptor -> !isDefault() + is CallableMemberDescriptor -> getKind() == CallableMemberDescriptor.Kind.DECLARATION + else -> true + } -- cgit