minor: fix typos and terminology

This commit is contained in:
Ilya Chernikov
2016-09-06 14:39:16 +02:00
parent ba4fab56a0
commit 0b68f313ab
4 changed files with 11 additions and 10 deletions
@@ -67,7 +67,8 @@ open class GenericRepl(
private val psiFileFactory: PsiFileFactoryImpl = PsiFileFactory.getInstance(environment.project) as PsiFileFactoryImpl private val psiFileFactory: PsiFileFactoryImpl = PsiFileFactory.getInstance(environment.project) as PsiFileFactoryImpl
private val analyzerEngine = CliReplAnalyzerEngine(environment) private val analyzerEngine = CliReplAnalyzerEngine(environment)
private class ChunkState( // "line" - is the unit of evaluation here, could in fact consists of several character lines
private class LineState(
val code: String, val code: String,
val psiFile: KtFile, val psiFile: KtFile,
val errorHolder: DiagnosticMessageHolder) val errorHolder: DiagnosticMessageHolder)
@@ -89,7 +90,7 @@ open class GenericRepl(
override fun getScriptParameters(scriptDescriptor: ScriptDescriptor): List<ScriptParameter> = emptyList() override fun getScriptParameters(scriptDescriptor: ScriptDescriptor): List<ScriptParameter> = emptyList()
} }
private var chunkState: ChunkState? = null private var lineState: LineState? = null
private var lastDependencies: KotlinScriptExternalDependencies? = null private var lastDependencies: KotlinScriptExternalDependencies? = null
@@ -117,7 +118,7 @@ open class GenericRepl(
val syntaxErrorReport = AnalyzerWithCompilerReport.Companion.reportSyntaxErrors(psiFile, errorHolder) val syntaxErrorReport = AnalyzerWithCompilerReport.Companion.reportSyntaxErrors(psiFile, errorHolder)
if (!syntaxErrorReport.isHasErrors) { if (!syntaxErrorReport.isHasErrors) {
chunkState = ChunkState(code, psiFile, errorHolder) lineState = LineState(code, psiFile, errorHolder)
} }
return when { return when {
@@ -131,11 +132,11 @@ open class GenericRepl(
fun eval(executionNumber: Long, code: String): EvalResult { fun eval(executionNumber: Long, code: String): EvalResult {
synchronized(this) { synchronized(this) {
val (psiFile, errorHolder) = run { val (psiFile, errorHolder) = run {
if (chunkState == null || chunkState!!.code != code) { if (lineState == null || lineState!!.code != code) {
val res = checkComplete(executionNumber, code) val res = checkComplete(executionNumber, code)
if (res != EvalResult.Ready) return@eval res if (res != EvalResult.Ready) return@eval res
} }
Pair(chunkState!!.psiFile, chunkState!!.errorHolder) Pair(lineState!!.psiFile, lineState!!.errorHolder)
} }
val newDependencies = scriptDefinition.getDependenciesFor(psiFile, environment.project, lastDependencies) val newDependencies = scriptDefinition.getDependenciesFor(psiFile, environment.project, lastDependencies)
@@ -28,7 +28,7 @@ import javax.script.*
class KotlinJsr232ScriptEngine( class KotlinJsr232ScriptEngine(
disposable: Disposable, disposable: Disposable,
private val factory: KotlinJsr232StandardScriptEngineFactory, private val factory: ScriptEngineFactory,
private val scriptDefinition: KotlinScriptDefinition, private val scriptDefinition: KotlinScriptDefinition,
private val compilerConfiguration: CompilerConfiguration private val compilerConfiguration: CompilerConfiguration
) : AbstractScriptEngine(), ScriptEngine { ) : AbstractScriptEngine(), ScriptEngine {
@@ -90,7 +90,7 @@ class ScriptTemplateTest {
@Test @Test
fun testScriptWithOverridenParam() { fun testScriptWithOverridenParam() {
val aClass = compileScript("overriden_parameter.kts", ScriptBaseClassWithOverridenProperty::class, null) val aClass = compileScript("overridden_parameter.kts", ScriptBaseClassWithOverriddenProperty::class, null)
Assert.assertNotNull(aClass) Assert.assertNotNull(aClass)
aClass!!.getConstructor(Integer.TYPE).newInstance(4) aClass!!.getConstructor(Integer.TYPE).newInstance(4)
} }
@@ -176,11 +176,11 @@ class ScriptTemplateTest {
private fun compileScript( private fun compileScript(
scriptPath: String, scriptPath: String,
scriptBase: KClass<out Any>, scriptTemplate: KClass<out Any>,
environment: Map<String, Any?>? = null, environment: Map<String, Any?>? = null,
runIsolated: Boolean = true, runIsolated: Boolean = true,
suppressOutput: Boolean = false): Class<*>? = suppressOutput: Boolean = false): Class<*>? =
compileScriptImpl("compiler/testData/script/" + scriptPath, KotlinScriptDefinitionFromTemplate(scriptBase, null, null, environment), runIsolated, suppressOutput) compileScriptImpl("compiler/testData/script/" + scriptPath, KotlinScriptDefinitionFromTemplate(scriptTemplate, null, null, environment), runIsolated, suppressOutput)
private fun compileScriptImpl( private fun compileScriptImpl(
scriptPath: String, scriptPath: String,
@@ -294,7 +294,7 @@ abstract class ScriptWithoutParams(num: Int)
@ScriptTemplateDefinition( @ScriptTemplateDefinition(
scriptFilePattern =".*\\.kts", scriptFilePattern =".*\\.kts",
resolver = TestKotlinScriptDependenciesResolver::class) resolver = TestKotlinScriptDependenciesResolver::class)
abstract class ScriptBaseClassWithOverridenProperty(override val num: Int) : TestClassWithOverridableProperty(num) abstract class ScriptBaseClassWithOverriddenProperty(override val num: Int) : TestClassWithOverridableProperty(num)
@ScriptTemplateDefinition(resolver = TestKotlinScriptDependenciesResolver::class) @ScriptTemplateDefinition(resolver = TestKotlinScriptDependenciesResolver::class)
abstract class ScriptWithArrayParam(val myArgs: Array<String>) abstract class ScriptWithArrayParam(val myArgs: Array<String>)