Refactor properties

This commit is contained in:
Ilya Chernikov
2018-07-15 23:16:48 +02:00
parent 904917c194
commit cf2162c445
13 changed files with 74 additions and 98 deletions
@@ -1,17 +0,0 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused")
package kotlin.script.experimental.api
import kotlin.script.experimental.util.typedKey
object ProcessedScriptDataProperties {
val foundAnnotations by typedKey<List<Annotation>>()
val foundFragments by typedKey<List<ScriptSourceNamedFragment>>()
}
@@ -8,12 +8,23 @@
package kotlin.script.experimental.api
import kotlin.script.experimental.util.ChainedPropertyBag
import kotlin.script.experimental.util.typedKey
typealias ScriptCompileConfiguration = ChainedPropertyBag
object ScriptCompileConfigurationProperties {
val sourceFragments by typedKey<List<ScriptSourceNamedFragment>>()
}
typealias ProcessedScriptData = ChainedPropertyBag
object ProcessedScriptDataProperties {
val foundAnnotations by typedKey<List<Annotation>>()
val foundFragments by typedKey<List<ScriptSourceNamedFragment>>()
}
interface RefineScriptCompilationConfiguration {
suspend operator fun invoke(
scriptSource: ScriptSource,
@@ -1,46 +0,0 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
@file:Suppress("unused")
package kotlin.script.experimental.api
import kotlin.script.experimental.util.typedKey
object ScriptCompileConfigurationProperties {
val sourceFragments by typedKey<List<ScriptSourceNamedFragment>>()
val baseClass = ScriptDefinitionProperties.baseClass
val scriptBodyTarget by typedKey<ScriptBodyTarget>()
val scriptImplicitReceivers by typedKey<List<KotlinType>>() // in the order from outer to inner scope
val contextVariables by typedKey<Map<String, KotlinType>>() // external variables
val defaultImports by typedKey<List<String>>()
val restrictions by typedKey<List<ResolvingRestrictionRule>>()
val importedScripts by typedKey<List<ScriptSource>>()
val dependencies by typedKey<List<ScriptDependency>>()
val generatedClassAnnotations by typedKey<List<Annotation>>()
val generatedMethodAnnotations by typedKey<List<Annotation>>()
val compilerOptions by typedKey<List<String>>() // Q: CommonCompilerOptions instead?
val refineConfiguration by typedKey<RefineScriptCompilationConfiguration>() // dynamic configurator
val refineBeforeParsing by typedKey<Boolean>() // default: false
val refineConfigurationOnAnnotations by typedKey<List<KotlinType>>()
val refineConfigurationOnSections by typedKey<List<String>>()
}
@@ -19,5 +19,33 @@ object ScriptDefinitionProperties {
val fileExtension by typedKey<String>() // default: "kts"
val baseClass by typedKey<KotlinType>() // script base class
val scriptBodyTarget by typedKey<ScriptBodyTarget>()
val scriptImplicitReceivers by typedKey<List<KotlinType>>() // in the order from outer to inner scope
val contextVariables by typedKey<Map<String, KotlinType>>() // external variables
val defaultImports by typedKey<List<String>>()
val restrictions by typedKey<List<ResolvingRestrictionRule>>()
val importedScripts by typedKey<List<ScriptSource>>()
val dependencies by typedKey<List<ScriptDependency>>()
val generatedClassAnnotations by typedKey<List<Annotation>>()
val generatedMethodAnnotations by typedKey<List<Annotation>>()
val compilerOptions by typedKey<List<String>>() // Q: CommonCompilerOptions instead?
val refineConfiguration by typedKey<RefineScriptCompilationConfiguration>() // dynamic configurator
val refineBeforeParsing by typedKey<Boolean>() // default: false
val refineConfigurationOnAnnotations by typedKey<List<KotlinType>>()
val refineConfigurationOnSections by typedKey<List<String>>()
}