@@ -74,19 +74,7 @@ trait GenJSExports extends SubComponent { self: GenJSCode =>
74
74
val exports = for {
75
75
(jsName, specs) <- ctorExports.groupBy(_._1.jsName) // group by exported name
76
76
} yield {
77
- val (namedExports, normalExports) = specs.partition(_._1.isNamed)
78
-
79
- val normalCtors = normalExports.map(s => ExportedSymbol (s._2))
80
- val namedCtors = for {
81
- (exp, ctor) <- namedExports
82
- } yield {
83
- implicit val pos = exp.pos
84
- ExportedBody (List (JSAnyTpe ),
85
- genNamedExporterBody(ctor, genFormalArg(1 ).ref),
86
- nme.CONSTRUCTOR .toString, pos)
87
- }
88
-
89
- val ctors = normalCtors ++ namedCtors
77
+ val ctors = specs.map(s => ExportedSymbol (s._2))
90
78
91
79
implicit val pos = ctors.head.pos
92
80
@@ -106,7 +94,6 @@ trait GenJSExports extends SubComponent { self: GenJSCode =>
106
94
exp <- jsInterop.registeredExportsOf(classSym)
107
95
} yield {
108
96
implicit val pos = exp.pos
109
- assert(! exp.isNamed, " Class cannot be exported named" )
110
97
111
98
exp.destination match {
112
99
case ExportDestination .Normal | ExportDestination .TopLevel =>
@@ -123,7 +110,6 @@ trait GenJSExports extends SubComponent { self: GenJSCode =>
123
110
exp <- jsInterop.registeredExportsOf(classSym)
124
111
} yield {
125
112
implicit val pos = exp.pos
126
- assert(! exp.isNamed, " Module cannot be exported named" )
127
113
128
114
exp.destination match {
129
115
case ExportDestination .Normal =>
@@ -237,66 +223,6 @@ trait GenJSExports extends SubComponent { self: GenJSCode =>
237
223
}
238
224
}
239
225
240
- /** Tests whether the given def a named exporter def that needs to be
241
- * generated with `genNamedExporterDef`.
242
- */
243
- def isNamedExporterDef (dd : DefDef ): Boolean = {
244
- jsInterop.isExport(dd.symbol) &&
245
- dd.symbol.annotations.exists(_.symbol == JSExportNamedAnnotation )
246
- }
247
-
248
- /** Generate the exporter proxy for a named export */
249
- def genNamedExporterDef (dd : DefDef ): Option [js.MethodDef ] = {
250
- implicit val pos = dd.pos
251
-
252
- if (isAbstractMethod(dd)) {
253
- None
254
- } else {
255
- val sym = dd.symbol
256
-
257
- val Block (Apply (fun, _) :: Nil , _) = dd.rhs
258
- val trgSym = fun.symbol
259
-
260
- val inArg =
261
- js.ParamDef (js.Ident (" namedParams" ), jstpe.AnyType ,
262
- mutable = false , rest = false )
263
- val inArgRef = inArg.ref
264
-
265
- val methodIdent = encodeMethodSym(sym)
266
-
267
- Some (js.MethodDef (static = false , methodIdent,
268
- List (inArg), toIRType(sym.tpe.resultType),
269
- Some (genNamedExporterBody(trgSym, inArg.ref)))(
270
- OptimizerHints .empty, None ))
271
- }
272
- }
273
-
274
- private def genNamedExporterBody (trgSym : Symbol , inArg : js.Tree )(
275
- implicit pos : Position ) = {
276
-
277
- if (hasRepeatedParam(trgSym)) {
278
- reporter.error(pos,
279
- " You may not name-export a method with a *-parameter" )
280
- }
281
-
282
- val jsArgs = for {
283
- (pSym, index) <- trgSym.info.params.zipWithIndex
284
- } yield {
285
- val rhs = js.JSBracketSelect (inArg,
286
- js.StringLiteral (pSym.name.decoded))
287
- js.VarDef (js.Ident (" namedArg$" + index), jstpe.AnyType ,
288
- mutable = false , rhs = rhs)
289
- }
290
-
291
- val jsArgRefs = jsArgs.map(_.ref)
292
-
293
- // Generate JS code to prepare arguments (default getters and unboxes)
294
- val jsArgPrep = genPrepareArgs(jsArgRefs, trgSym)
295
- val jsResult = genResult(trgSym, jsArgPrep.map(_.ref), static = false )
296
-
297
- js.Block (jsArgs ++ jsArgPrep :+ jsResult)
298
- }
299
-
300
226
private def genMemberExport (classSym : Symbol , name : TermName ): js.Tree = {
301
227
val alts = classSym.info.member(name).alternatives
302
228
0 commit comments