Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit 606b8f4

Browse files
committed
Merge WasmExpressionBuilder and WasmFunctionContext into FunctionEmitter.
The combined class has the same responsibilities as the `FunctionEmitter` in the JS backend.
1 parent 9339ec2 commit 606b8f4

File tree

3 files changed

+300
-384
lines changed

3 files changed

+300
-384
lines changed

Diff for: wasm/src/main/scala/org/scalajs/linker/backend/wasmemitter/ClassEmitter.scala

+7-7
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
755755
val postSuperStatsFunctionName = genFunctionName.postSuperStats(clazz.className)
756756
val ctor = clazz.jsConstructorDef.get
757757

758-
WasmExpressionBuilder.emitJSConstructorFunctions(
758+
FunctionEmitter.emitJSConstructorFunctions(
759759
preSuperStatsFunctionName,
760760
superArgsFunctionName,
761761
postSuperStatsFunctionName,
@@ -822,7 +822,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
822822
case _ =>
823823
// For everything else, put the tree in its own function and call it
824824
val closureFuncName = genInnerFuncName()
825-
WasmExpressionBuilder.emitFunction(
825+
FunctionEmitter.emitFunction(
826826
closureFuncName,
827827
enclosingClassName = None,
828828
Some(jsClassCaptures),
@@ -903,7 +903,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
903903
genLoadIsolatedTree(nameTree)
904904

905905
val closureFuncName = genInnerFuncName()
906-
WasmExpressionBuilder.emitFunction(
906+
FunctionEmitter.emitFunction(
907907
closureFuncName,
908908
Some(clazz.className),
909909
Some(jsClassCaptures),
@@ -930,7 +930,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
930930

931931
case Some(getterBody) =>
932932
val closureFuncName = genInnerFuncName()
933-
WasmExpressionBuilder.emitFunction(
933+
FunctionEmitter.emitFunction(
934934
closureFuncName,
935935
Some(clazz.className),
936936
Some(jsClassCaptures),
@@ -949,7 +949,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
949949

950950
case Some((setterParamDef, setterBody)) =>
951951
val closureFuncName = genInnerFuncName()
952-
WasmExpressionBuilder.emitFunction(
952+
FunctionEmitter.emitFunction(
953953
closureFuncName,
954954
Some(clazz.className),
955955
Some(jsClassCaptures),
@@ -1092,7 +1092,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
10921092
val exportedName = exportDef.topLevelExportName
10931093
val functionName = genFunctionName.forExport(exportedName)
10941094

1095-
WasmExpressionBuilder.emitFunction(
1095+
FunctionEmitter.emitFunction(
10961096
functionName,
10971097
enclosingClassName = None,
10981098
captureParamDefs = None,
@@ -1174,7 +1174,7 @@ class ClassEmitter(coreSpec: CoreSpec) {
11741174
val body = method.body.getOrElse(throw new Exception("abstract method cannot be transformed"))
11751175

11761176
// Emit the function
1177-
WasmExpressionBuilder.emitFunction(
1177+
FunctionEmitter.emitFunction(
11781178
functionName,
11791179
Some(className),
11801180
captureParamDefs = None,

0 commit comments

Comments
 (0)