Is it possible to add synthetic class to package l...
# compiler
p
Is it possible to add synthetic class to package level in SyntheticResolveExtension?
r
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
Hello, Raul! How can I obtain it?
s
You can use PackageFragmentProviderExtension for JVM afaik other platforms don't support it 🙂
p
Thanks! But mostly I need it for JS. 🙂
r
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
    )
  }
}
p
Unfortunately it is not triggered by JS.