Add API to get locations of collected script annotations
#KT-38404 fixed also: - Add wrapper class for the location combined with the location id - Add source code location parameters to external dependency resolvers - Add tests for locations in annotations - Add tests for order of annotation resolution for dependencies resolvers
This commit is contained in:
committed by
Ilya Chernikov
parent
1539128c3f
commit
83087291df
+15
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package kotlin.script.experimental.util
|
||||
|
||||
import kotlin.script.experimental.api.*
|
||||
|
||||
inline fun <reified A : Annotation> Iterable<ScriptSourceAnnotation<*>>.filterByAnnotationType(
|
||||
): List<ScriptSourceAnnotation<A>> = filter { it.annotation is A }
|
||||
.map {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
it as ScriptSourceAnnotation<A>
|
||||
}
|
||||
Reference in New Issue
Block a user