Skip to content

Commit

Permalink
Clean up to match code style
Browse files Browse the repository at this point in the history
  • Loading branch information
waleedyaseen committed Oct 7, 2023
1 parent 55fb103 commit 796783f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ class RuneScriptInvalidSymbolFileInspection : LocalInspectionTool() {
}
val module = ModuleUtilCore.findModuleForPsiElement(file)
val moduleDir = module?.guessModuleDir() ?: return null
val symbolsDir = moduleDir.findChild("symbols") ?: return null
val fileDir = file.containingDirectory ?: return null
val symbolsDir = moduleDir.findChild("symbols") ?: return null
val fileDir = file.containingDirectory ?: return null
if (fileDir.virtualFile != symbolsDir) {
return null
}
val name = file.containingFile.name
val typeName = name.substring(0, name.indexOf('.'))
if (typeName == "commands") {
// Technically this is not a type, but is required by the compiler.
return null;
return null
}
if (RsPrimitiveType.lookupOrNull(typeName) == null) {
return arrayOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiFileFactory
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.TokenType
import com.intellij.psi.impl.PsiFileFactoryImpl
import com.intellij.psi.tree.TokenSet
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.psi.util.childrenOfType
import com.intellij.testFramework.LightVirtualFile
import io.runescript.plugin.ide.filetypes.RsFileType
import io.runescript.plugin.lang.RuneScript
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,20 +598,21 @@ class RsTypeInferenceVisitor(private val myInferenceData: RsTypeInference) : RsV
set(value) = myInferenceData.typeHintInferred(this, value)

private fun findParameterType(o: RsParameter): RsType {
if (o.arrayTypeLiteral != null) {
return if (o.arrayTypeLiteral != null) {
val definitionLiteral = o.arrayTypeLiteral!!.text
val typeLiteral = definitionLiteral.substring(0, definitionLiteral.length - "array".length)
val elementType = RsPrimitiveType.lookupReferencable(typeLiteral)
return RsArrayType(elementType)
RsArrayType(elementType)
} else if (o.typeName != null) {
val typeLiteral = o.typeName!!.text
if (o.parentOfType<RsScript>()?.triggerName == "command") {
return RsPrimitiveType.lookup(typeLiteral)
RsPrimitiveType.lookup(typeLiteral)
} else {
return RsPrimitiveType.lookupReferencable(typeLiteral)
RsPrimitiveType.lookupReferencable(typeLiteral)
}
} else {
RsErrorType
}
return RsErrorType
}

override fun visitReturnStatement(o: RsReturnStatement) {
Expand Down

0 comments on commit 796783f

Please sign in to comment.