@@ -683,12 +683,12 @@ private[emitter] final class ClassEmitter(sjsGen: SJSGen) {
683683
684684 def genInstanceTests (className : ClassName , kind : ClassKind )(
685685 implicit moduleContext : ModuleContext ,
686- globalKnowledge : GlobalKnowledge , pos : Position ): WithGlobals [js.Tree ] = {
686+ globalKnowledge : GlobalKnowledge , pos : Position ): WithGlobals [List [ js.Tree ] ] = {
687687 for {
688688 single <- genSingleInstanceTests(className, kind)
689689 array <- genArrayInstanceTests(className)
690690 } yield {
691- js. Block ( single ::: array)
691+ single ::: array
692692 }
693693 }
694694
@@ -1028,16 +1028,16 @@ private[emitter] final class ClassEmitter(sjsGen: SJSGen) {
10281028 case e : TopLevelMethodExportDef =>
10291029 genTopLevelMethodExportDef(e)
10301030 case e : TopLevelFieldExportDef =>
1031- genTopLevelFieldExportDef(topLevelExport.owningClass, e)
1031+ genTopLevelFieldExportDef(topLevelExport.owningClass, e).map(_ :: Nil )
10321032 }
10331033 }
10341034
1035- WithGlobals .list (exportsWithGlobals)
1035+ WithGlobals .flatten (exportsWithGlobals)
10361036 }
10371037
10381038 private def genTopLevelMethodExportDef (tree : TopLevelMethodExportDef )(
10391039 implicit moduleContext : ModuleContext ,
1040- globalKnowledge : GlobalKnowledge ): WithGlobals [js.Tree ] = {
1040+ globalKnowledge : GlobalKnowledge ): WithGlobals [List [ js.Tree ] ] = {
10411041 import TreeDSL ._
10421042
10431043 val JSMethodDef (flags, StringLiteral (exportName), args, restParam, body) =
@@ -1056,22 +1056,22 @@ private[emitter] final class ClassEmitter(sjsGen: SJSGen) {
10561056
10571057 private def genConstValueExportDef (exportName : String ,
10581058 exportedValue : js.Tree )(
1059- implicit pos : Position ): WithGlobals [js.Tree ] = {
1059+ implicit pos : Position ): WithGlobals [List [ js.Tree ] ] = {
10601060 moduleKind match {
10611061 case ModuleKind .NoModule =>
1062- genAssignToNoModuleExportVar(exportName, exportedValue)
1062+ genAssignToNoModuleExportVar(exportName, exportedValue).map(_ :: Nil )
10631063
10641064 case ModuleKind .ESModule =>
10651065 val field = fileLevelVar(VarField .e, exportName)
10661066 val let = js.Let (field.ident, mutable = true , Some (exportedValue))
10671067 val exportStat = js.Export ((field.ident -> js.ExportName (exportName)) :: Nil )
1068- WithGlobals (js. Block (let, exportStat))
1068+ WithGlobals (List (let, exportStat))
10691069
10701070 case ModuleKind .CommonJSModule =>
10711071 globalRef(" exports" ).map { exportsVarRef =>
10721072 js.Assign (
10731073 genBracketSelect(exportsVarRef, js.StringLiteral (exportName)),
1074- exportedValue)
1074+ exportedValue) :: Nil
10751075 }
10761076 }
10771077 }
0 commit comments