Skip to content

Commit 3a3f83a

Browse files
committed
Update the compiler to emit constructors with NoType.
This is follow up to the parent commit to bring the behavior of the compiler up to date with the tools.
1 parent 721b9f9 commit 3a3f83a

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

compiler/src/main/scala/org/scalajs/core/compiler/GenJSCode.scala

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -786,8 +786,8 @@ abstract class GenJSCode extends plugins.PluginComponent
786786
optimizerHints, None)
787787
} else if (sym.isClassConstructor) {
788788
js.MethodDef(static = false, methodName,
789-
jsParams, currentClassType,
790-
js.Block(genStat(rhs), genThis()))(optimizerHints, None)
789+
jsParams, jstpe.NoType,
790+
genStat(rhs))(optimizerHints, None)
791791
} else {
792792
val resultIRType = toIRType(sym.tpe.resultType)
793793
genMethodDef(static = sym.owner.isImplClass, methodName,
@@ -1704,7 +1704,7 @@ abstract class GenJSCode extends plugins.PluginComponent
17041704
isModuleInitialized = true
17051705
val thisType = jstpe.ClassType(encodeClassFullName(currentClassSym))
17061706
val initModule = js.StoreModule(thisType, js.This()(thisType))
1707-
js.Block(superCall, initModule, js.This()(thisType))
1707+
js.Block(superCall, initModule)
17081708
} else {
17091709
superCall
17101710
}
@@ -1888,8 +1888,11 @@ abstract class GenJSCode extends plugins.PluginComponent
18881888
arguments: List[js.Tree])(implicit pos: Position): js.Tree = {
18891889
val className = encodeClassFullName(method.owner)
18901890
val methodIdent = encodeMethodSym(method)
1891+
val resultType =
1892+
if (method.isClassConstructor) jstpe.NoType
1893+
else toIRType(method.tpe.resultType)
18911894
js.ApplyStatically(receiver, jstpe.ClassType(className),
1892-
methodIdent, arguments)(toIRType(method.tpe.resultType))
1895+
methodIdent, arguments)(resultType)
18931896
}
18941897

18951898
def genTraitImplApply(method: Symbol, arguments: List[js.Tree])(

ir/src/main/scala/org/scalajs/core/ir/Serializers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,8 +588,8 @@ object Serializers {
588588

589589
private final class Deserializer(stream: InputStream, sourceVersion: String) {
590590
private[this] val useHacks060 = sourceVersion == "0.6.0"
591-
private[this] val useHacks065 = true
592-
//Set("0.6.0", "0.6.3", "0.6.4", "0.6.5").contains(sourceVersion)
591+
private[this] val useHacks065 =
592+
Set("0.6.0", "0.6.3", "0.6.4", "0.6.5").contains(sourceVersion)
593593

594594
private[this] val input = new DataInputStream(stream)
595595

project/JavaLangObject.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ object JavaLangObject {
3636
static = false,
3737
Ident("init___", Some("<init>")),
3838
Nil,
39-
AnyType,
40-
This()(ThisType))(OptimizerHints.empty, None),
39+
NoType,
40+
Skip())(OptimizerHints.empty, None),
4141

4242
/* def hashCode(): Int = System.identityHashCode(this) */
4343
MethodDef(

0 commit comments

Comments
 (0)