Skip to content

Commit 2d5513d

Browse files
committed
make kt compiler happy
1 parent 2ffab96 commit 2d5513d

File tree

11 files changed

+32
-24
lines changed

11 files changed

+32
-24
lines changed

src/main/java/com/tang/intellij/lua/documentation/LuaDocumentationProvider.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,10 @@ class LuaDocumentationProvider : AbstractDocumentationProvider(), DocumentationP
7070
private fun genDoc(owner: LuaCommentOwner): String? {
7171
val sb = StringBuilder()
7272
if (owner is LuaFuncBodyOwner && owner is PsiNameIdentifierOwner) {
73-
val funcBodyOwner = owner as LuaFuncBodyOwner
7473
val methodDef = owner as PsiNameIdentifierOwner
7574
sb.append("<h1>")
7675
sb.append(methodDef.name)
77-
sb.append(funcBodyOwner.paramSignature)
76+
sb.append(owner.paramSignature)
7877
sb.append("</h1><br>")
7978
}
8079

src/main/java/com/tang/intellij/lua/editor/structure/LuaFileElement.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ class LuaFileElement(private val file: LuaFile) : StructureViewTreeElement {
9494

9595
override fun visitElement(element: PsiElement?) {
9696
if (element is LuaCommentOwner) {
97-
val owner = element as LuaCommentOwner?
98-
val comment = owner!!.comment
97+
val comment = element.comment
9998
if (comment != null)
10099
visitDocComment(comment)
101100
}

src/main/java/com/tang/intellij/lua/psi/LuaPsiImplUtil.kt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,7 @@ object LuaPsiImplUtil {
356356

357357
@JvmStatic fun guessReturnTypeSet(owner: LuaFuncBodyOwner, searchContext: SearchContext): LuaTypeSet? {
358358
if (owner is StubBasedPsiElementBase<*>) {
359-
val stubElement = owner as StubBasedPsiElementBase<*>
360-
val stub = stubElement.stub
359+
val stub = owner.stub
361360
if (stub is LuaFuncBodyOwnerStub<*>) {
362361
return stub.returnTypeSet
363362
}
@@ -370,7 +369,7 @@ object LuaPsiImplUtil {
370369

371370
@JvmStatic fun guessReturnTypeSetOriginal(owner: LuaFuncBodyOwner, searchContext: SearchContext): LuaTypeSet {
372371
if (owner is LuaCommentOwner) {
373-
val comment = LuaCommentUtil.findComment(owner as LuaCommentOwner)
372+
val comment = LuaCommentUtil.findComment(owner)
374373
if (comment != null) {
375374
val returnDef = PsiTreeUtil.findChildOfType(comment, LuaDocReturnDef::class.java)
376375
if (returnDef != null) {
@@ -407,11 +406,9 @@ object LuaPsiImplUtil {
407406

408407
@JvmStatic fun getParams(owner: LuaFuncBodyOwner): Array<LuaParamInfo?> {
409408
if (owner is StubBasedPsiElementBase<*>) {
410-
val stubElement = owner as StubBasedPsiElementBase<*>
411-
val stub = stubElement.stub
409+
val stub = owner.stub
412410
if (stub is LuaFuncBodyOwnerStub<*>) {
413-
val funcBodyOwnerStub = stub as LuaFuncBodyOwnerStub<*>?
414-
return funcBodyOwnerStub!!.params
411+
return stub.params
415412
}
416413
}
417414
return getParamsOriginal(owner)
@@ -420,7 +417,7 @@ object LuaPsiImplUtil {
420417
@JvmStatic fun getParamsOriginal(funcBodyOwner: LuaFuncBodyOwner): Array<LuaParamInfo?> {
421418
var comment: LuaComment? = null
422419
if (funcBodyOwner is LuaCommentOwner) {
423-
comment = LuaCommentUtil.findComment(funcBodyOwner as LuaCommentOwner)
420+
comment = LuaCommentUtil.findComment(funcBodyOwner)
424421
}
425422

426423
val paramNameList = funcBodyOwner.paramNameDefList

src/main/java/com/tang/intellij/lua/psi/impl/LuaExprMixin.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ open class LuaExprMixin internal constructor(node: ASTNode) : LuaPsiElementImpl(
3333
return RecursionManager.doPreventingRecursion<LuaTypeSet>(this, true) {
3434
var set: LuaTypeSet? = null
3535
if (this is LuaCallExpr)
36-
set = guessType(this as LuaCallExpr, context)
36+
set = guessType(this, context)
3737
if (this is LuaParenExpr)
38-
set = guessType(this as LuaParenExpr, context)
38+
set = guessType(this, context)
3939
else if (this is LuaLiteralExpr)
40-
set = guessType(this as LuaLiteralExpr)
40+
set = guessType(this)
4141
set
4242
}
4343
}

src/main/java/com/tang/intellij/lua/psi/impl/LuaIndexExprMixin.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,11 @@ open class LuaIndexExprMixin : StubBasedPsiElementBase<LuaIndexStub>, LuaExpress
9393
val all = LuaClassFieldIndex.findAll(type, fieldName, context)
9494
for (fieldDef in all) {
9595
if (fieldDef is LuaIndexExpr) {
96-
val indexExpr = fieldDef as LuaIndexExpr
97-
val stub = indexExpr.stub
96+
val stub = fieldDef.stub
9897
if (stub != null)
9998
set = set.union(stub.guessValueType())
10099
else
101-
set = set.union(indexExpr.guessValueType(context))
100+
set = set.union(fieldDef.guessValueType(context))
102101

103102
if (fieldDef === this)
104103
return set

src/main/java/com/tang/intellij/lua/stubs/types/LuaClassMethodType.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ class LuaClassMethodType : IStubElementType<LuaClassMethodStub, LuaClassMethodDe
106106

107107
val returnTypeSet = LuaTypeSet.deserialize(stubInputStream)
108108
val isStatic = stubInputStream.readBoolean()
109-
return LuaClassMethodStubImpl(StringRef.toString(shortName), StringRef.toString(className), params, returnTypeSet, isStatic, stubElement)
109+
return LuaClassMethodStubImpl(StringRef.toString(shortName)!!,
110+
StringRef.toString(className)!!,
111+
params,
112+
returnTypeSet,
113+
isStatic,
114+
stubElement)
110115
}
111116

112117
override fun indexStub(luaClassMethodStub: LuaClassMethodStub, indexSink: IndexSink) {

src/main/java/com/tang/intellij/lua/stubs/types/LuaDocClassFieldType.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,10 @@ class LuaDocClassFieldType : IStubElementType<LuaDocClassFieldStub, LuaDocFieldD
7575
val name = stubInputStream.readName()
7676
val className = stubInputStream.readName()
7777
val typeSet = LuaTypeSet.deserialize(stubInputStream)
78-
return LuaDocClassFieldStubImpl(stubElement, StringRef.toString(name), StringRef.toString(className), typeSet)
78+
return LuaDocClassFieldStubImpl(stubElement,
79+
StringRef.toString(name)!!,
80+
StringRef.toString(className)!!,
81+
typeSet)
7982
}
8083

8184
override fun indexStub(luaFieldStub: LuaDocClassFieldStub, indexSink: IndexSink) {

src/main/java/com/tang/intellij/lua/stubs/types/LuaDocClassType.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ class LuaDocClassType : IStubElementType<LuaDocClassStub, LuaDocClassDef>("Class
6262
val className = stubInputStream.readName()
6363
val aliasName = stubInputStream.readName()
6464
val superClassName = stubInputStream.readName()
65-
return LuaDocClassStubImpl(StringRef.toString(className), StringRef.toString(aliasName), StringRef.toString(superClassName), stubElement)
65+
return LuaDocClassStubImpl(StringRef.toString(className)!!,
66+
StringRef.toString(aliasName),
67+
StringRef.toString(superClassName),
68+
stubElement)
6669
}
6770

6871
override fun indexStub(luaDocClassStub: LuaDocClassStub, indexSink: IndexSink) {

src/main/java/com/tang/intellij/lua/stubs/types/LuaGlobalFuncType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class LuaGlobalFuncType : IStubElementType<LuaGlobalFuncStub, LuaGlobalFuncDef>(
8787
}
8888

8989
val returnTypeSet = LuaTypeSet.deserialize(stubInputStream)
90-
return LuaGlobalFuncStubImpl(StringRef.toString(name), params, returnTypeSet, stubElement)
90+
return LuaGlobalFuncStubImpl(StringRef.toString(name)!!, params, returnTypeSet, stubElement)
9191
}
9292

9393
override fun indexStub(luaGlobalFuncStub: LuaGlobalFuncStub, indexSink: IndexSink) {

src/main/java/com/tang/intellij/lua/stubs/types/LuaNameType.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class LuaNameType : IStubElementType<LuaNameStub, LuaNameExpr>("NameExpr", LuaLa
5656
@Throws(IOException::class)
5757
override fun deserialize(stubInputStream: StubInputStream, stubElement: StubElement<*>): LuaNameStub {
5858
val nameRef = stubInputStream.readName()
59-
return LuaNameStubImpl(StringRef.toString(nameRef), stubElement, this)
59+
return LuaNameStubImpl(StringRef.toString(nameRef)!!, stubElement, this)
6060
}
6161

6262
override fun indexStub(luaNameStub: LuaNameStub, indexSink: IndexSink) {

0 commit comments

Comments
 (0)