Skip to content

Commit

Permalink
[PSI] KtCommonFile: deprecate isScriptByTree
Browse files Browse the repository at this point in the history
^KT-73687
  • Loading branch information
dimonchik0036 authored and qodana-bot committed Dec 9, 2024
1 parent 6c1ba5f commit 86f47a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions compiler/psi/src/org/jetbrains/kotlin/psi/KtCommonFile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ open class KtCommonFile(viewProvider: FileViewProvider, val isCompiled: Boolean)
}
}

@Deprecated("Use 'isScript()' instead", ReplaceWith("isScript()"))
val isScriptByTree: Boolean
get() = script != null
get() = isScript()

/**
* @return modifier lists that do not belong to any declaration due to incomplete code or syntax errors
Expand Down Expand Up @@ -266,7 +267,7 @@ open class KtCommonFile(viewProvider: FileViewProvider, val isCompiled: Boolean)
hasImportAlias = null
}

fun isScript(): Boolean = isScript ?: greenStub?.isScript() ?: isScriptByTree
fun isScript(): Boolean = isScript ?: greenStub?.isScript() ?: (script != null)

fun hasTopLevelCallables(): Boolean {
hasTopLevelCallables?.let { return it }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ open class StubIndexService protected constructor() {
}

open fun createFileStub(file: KtFile): KotlinFileStub {
return KotlinFileStubImpl(file, file.packageFqName.asString(), file.isScriptByTree)
return KotlinFileStubImpl(file, file.packageFqName.asString(), file.isScript())
}

@Throws(IOException::class)
Expand Down

0 comments on commit 86f47a8

Please sign in to comment.