Is it possible to add synthetic class to package level in SyntheticResolveExtension?
r
raulraja
05/14/2020, 9:42 AM
My experience is that you need a PackageFragmentProvider for that. Those interfaces also have no notion of top level functions AFAIK but maybe that has changed recently. Last time I tried was 6 months ago
p
PHondogo
05/14/2020, 10:16 AM
Hello, Raul! How can I obtain it?
s
shikasd
05/14/2020, 10:22 AM
You can use PackageFragmentProviderExtension for JVM
afaik other platforms don't support it 🙂
p
PHondogo
05/14/2020, 10:37 AM
Thanks! But mostly I need it for JS. 🙂
r
ralf
05/14/2020, 4:44 PM
I used an AnalysisHandlerExtension, I don’t know if that works in JS
Copy code
class MyAnalysisHandlerExtension(
private val codeGenDir: File
) : AnalysisHandlerExtension {
private var didRecompile = false
override fun analysisCompleted(
project: Project,
module: ModuleDescriptor,
bindingTrace: BindingTrace,
files: Collection<KtFile>
): AnalysisResult? {
// This restarts the analysis phase and will include our file.
return RetryWithAdditionalRoots(
bindingTrace.bindingContext, module, emptyList(), listOf(codeGenDir), true
)
}
}