Skip to content

Commit b1bb0df

Browse files
committed
Scala.js: Do not emit static forwarders for native JS defs.
Nor for their default param accessors. This is a forward port of scala-js/scala-js@a95f3f6
1 parent 0fb52be commit b1bb0df

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,21 @@ class JSCodeGen()(using genCtx: Context) {
789789

790790
def isExcluded(m: Symbol): Boolean = {
791791
def hasAccessBoundary = m.accessBoundary(defn.RootClass) ne defn.RootClass
792-
m.is(Deferred) || m.isConstructor || hasAccessBoundary || (m.owner eq defn.ObjectClass)
792+
793+
def isOfJLObject: Boolean = m.owner eq defn.ObjectClass
794+
795+
def isDefaultParamOfJSNativeDef: Boolean = {
796+
m.name.is(DefaultGetterName) && {
797+
val info = new DefaultParamInfo(m)
798+
!info.isForConstructor && info.attachedMethod.hasAnnotation(jsdefn.JSNativeAnnot)
799+
}
800+
}
801+
802+
m.is(Deferred)
803+
|| m.isConstructor
804+
|| hasAccessBoundary
805+
|| isOfJLObject
806+
|| m.hasAnnotation(jsdefn.JSNativeAnnot) || isDefaultParamOfJSNativeDef // #4557
793807
}
794808

795809
val forwarders = for {

0 commit comments

Comments
 (0)