Skip to content

Commit 49e1ffc

Browse files
committed
WIP 48 - use def rather than closure in Discover macro
1 parent f986c19 commit 49e1ffc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main/define/src/mill/define/Discover.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ object Discover {
164164
// by wrapping the `overridesRoutes` in a lambda function we kind of work around
165165
// the problem of generating a *huge* macro method body that finally exceeds the
166166
// JVM's maximum allowed method size
167-
val overridesLambda = '{(() => (${Expr(names)}, $mainDatas))()}
167+
val overridesLambda = '{
168+
def pair() = (${Expr(names)}, $mainDatas)
169+
pair()
170+
}
168171
val lhs = Ref(defn.Predef_classOf).appliedToType(discoveredModuleType.widen).asExprOf[Class[?]]
169172
'{$lhs -> $overridesLambda}
170173
}
@@ -176,7 +179,7 @@ object Discover {
176179
Discover.apply2(Map(${Varargs(mapping)}*))
177180
}
178181
// TODO: if needed for debugging, we can re-enable this
179-
// report.warning(s"generated maindata for ${TypeRepr.of[T].show}:\n${expr.asTerm.show}", TypeRepr.of[T].typeSymbol.pos.getOrElse(Position.ofMacroExpansion))
182+
// report.warning(s"generated discovery for ${TypeRepr.of[T].show}:\n${expr.asTerm.show}", TypeRepr.of[T].typeSymbol.pos.getOrElse(Position.ofMacroExpansion))
180183
expr
181184
}
182185
}

0 commit comments

Comments
 (0)