8000 Merge pull request #5140 from sjrd/fix-incremental-instance-tests-wit… · scala-js/scala-js@7d15aad · GitHub
[go: up one dir, main page]

Skip to content

Commit 7d15aad

Browse files
authored
Merge pull request #5140 from sjrd/fix-incremental-instance-tests-with-modules
Fix #5131: Overhaul justifications for caching in Emitter.genClass.
2 parents cc670fb + a7a613b commit 7d15aad

File tree

5 files changed

+421
-133
lines changed

5 files changed

+421
-133
lines changed

linker/shared/src/main/scala/org/scalajs/linker/backend/emitter/ClassEmitter.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private[emitter] final class ClassEmitter(sjsGen: SJSGen) {
6161
if (useESClass) {
6262
val parentVarWithGlobals = for (parentIdent <- superClass) yield {
6363
implicit val pos = parentIdent.pos
64-
if (shouldExtendJSError(className, superClass)) globalRef("Error")
64+
if (shouldExtendJSError(className)) globalRef("Error")
6565
else WithGlobals(globalVar(VarField.c, parentIdent.name))
6666
}
6767

@@ -190,7 +190,7 @@ private[emitter] final class ClassEmitter(sjsGen: SJSGen) {
190190
case None =>
191191
WithGlobals(setPrototypeVar(ctorVar))
192192

193-
case Some(_) if shouldExtendJSError(className, superClass) =>
193+
case Some(_) if shouldExtendJSError(className) =>
194194
globalRef("Error").map(chainPrototypeWithLocalCtor(className, ctorVar, _, localDeclPrototypeVar = false))
195195

196196
case Some(parentIdent) =>
@@ -1149,6 +1149,6 @@ private[emitter] object ClassEmitter {
11491149
private val ClassInitializerOriginalName: OriginalName =
11501150
OriginalName("<clinit>")
11511151

1152-
def shouldExtendJSError(className: ClassName, superClass: Option[ClassIdent]): Boolean =
1153-
className == ThrowableClass && superClass.exists(_.name == ObjectClass)
1152+
def shouldExtendJSError(className: ClassName): Boolean =
1153+
className == ThrowableClass
11541154
}

0 commit comments

Comments
 (0)
0