Cleanup in js modules
This commit is contained in:
@@ -92,7 +92,7 @@ public class JsCallChecker(
|
||||
val parserScope = JsFunctionScope(JsRootScope(JsProgram("<js checker>")), "<js fun>")
|
||||
val statements = parse(code, errorReporter, parserScope)
|
||||
|
||||
if (statements.size() == 0) {
|
||||
if (statements.size == 0) {
|
||||
context.trace.report(ErrorsJs.JSCODE_NO_JAVASCRIPT_PRODUCED.on(argument))
|
||||
}
|
||||
} catch (e: AbortParsingException) {
|
||||
@@ -153,8 +153,8 @@ private fun String.offsetOf(position: CodePosition): Int {
|
||||
var lineCount = 0
|
||||
var offsetInLine = 0
|
||||
|
||||
while (i < length()) {
|
||||
val c = charAt(i)
|
||||
while (i < length) {
|
||||
val c = this[i]
|
||||
|
||||
if (lineCount == position.line && offsetInLine == position.offset) {
|
||||
return i
|
||||
@@ -170,7 +170,7 @@ private fun String.offsetOf(position: CodePosition): Int {
|
||||
}
|
||||
}
|
||||
|
||||
return length()
|
||||
return length
|
||||
}
|
||||
|
||||
private val KtExpression.isConstantStringLiteral: Boolean
|
||||
|
||||
@@ -68,7 +68,7 @@ public fun String.underlineAsText(from: Int, to: Int): String {
|
||||
var lineWasMarked = false
|
||||
|
||||
for (i in indices) {
|
||||
val c = charAt(i)
|
||||
val c = this[i]
|
||||
val mark: Char
|
||||
|
||||
mark = when (i) {
|
||||
@@ -105,7 +105,7 @@ public fun String.underlineAsHtml(from: Int, to: Int): String {
|
||||
val underlineEnd = "</u>"
|
||||
|
||||
for (i in indices) {
|
||||
val c = charAt(i)
|
||||
val c = this[i]
|
||||
|
||||
val mark = when (i) {
|
||||
from -> {
|
||||
|
||||
@@ -74,7 +74,7 @@ internal abstract class AbstractNativeIndexerChecker(
|
||||
override fun additionalCheck(declaration: KtNamedFunction, descriptor: FunctionDescriptor, diagnosticHolder: DiagnosticSink) {
|
||||
val parameters = descriptor.getValueParameters()
|
||||
val builtIns = descriptor.builtIns
|
||||
if (parameters.size() > 0) {
|
||||
if (parameters.size > 0) {
|
||||
val firstParamClassDescriptor = DescriptorUtils.getClassDescriptorForType(parameters.get(0).getType())
|
||||
if (firstParamClassDescriptor != builtIns.string &&
|
||||
!DescriptorUtils.isSubclass(firstParamClassDescriptor, builtIns.number)
|
||||
@@ -83,7 +83,7 @@ internal abstract class AbstractNativeIndexerChecker(
|
||||
}
|
||||
}
|
||||
|
||||
if (parameters.size() != requiredParametersCount) {
|
||||
if (parameters.size != requiredParametersCount) {
|
||||
diagnosticHolder.report(ErrorsJs.NATIVE_INDEXER_WRONG_PARAMETER_COUNT.on(declaration, requiredParametersCount, indexerKind))
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ internal class NativeSetterChecker : AbstractNativeIndexerChecker(PredefinedAnno
|
||||
if (returnType == null || KotlinBuiltIns.isUnit(returnType)) return
|
||||
|
||||
val parameters = descriptor.getValueParameters()
|
||||
if (parameters.size() < 2) return
|
||||
if (parameters.size < 2) return
|
||||
|
||||
val secondParameterType = parameters.get(1).getType()
|
||||
if (secondParameterType.isSubtypeOf(returnType)) return
|
||||
|
||||
Reference in New Issue
Block a user