Skip to content

Commit 2f66576

Browse files
committed
fix set operator with function type parameter
1 parent eb17414 commit 2f66576

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/main/kotlin/de/rakhman/webextensions/Generator.kt

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,20 @@ class Generator(val dir: File) {
134134

135135
return PropertySpec
136136
.builder(event.name, type)
137-
.apply { event.description?.let { addKdoc(buildString {
138-
append(it.cleanupDescription())
139-
event.parameters?.forEach {
140-
append('\n')
141-
append("@param ")
142-
append(it.name)
143-
append(' ')
144-
append(it.description)
137+
.apply {
138+
event.description?.let {
139+
addKdoc(buildString {
140+
append(it.cleanupDescription())
141+
event.parameters?.forEach {
142+
append('\n')
143+
append("@param ")
144+
append(it.name)
145+
append(' ')
146+
append(it.description)
147+
}
148+
})
145149
}
146-
}) } }
150+
}
147151
.build()
148152
}
149153

@@ -272,7 +276,11 @@ class Generator(val dir: File) {
272276
FunSpec.builder("set")
273277
.addModifiers(KModifier.OPERATOR, KModifier.INLINE)
274278
.addParameter("key", ClassName.bestGuess("String"))
275-
.addParameter("value", parameterType("", type))
279+
.addParameter(
280+
"value",
281+
parameterType("", type),
282+
*if (type.type == "function") arrayOf(KModifier.NOINLINE) else arrayOf()
283+
)
276284
.addCode("asDynamic()[key] = value\n")
277285
.build()
278286
)

0 commit comments

Comments
 (0)