@@ -45,10 +45,10 @@ class CompiledFile(
4545 }
4646
4747 fun typeOfExpression (expression : KtExpression , scopeWithImports : LexicalScope ): KotlinType ? =
48- bindingContextOf(expression, scopeWithImports).getType(expression)
48+ bindingContextOf(expression, scopeWithImports)? .getType(expression)
4949
50- fun bindingContextOf (expression : KtExpression , scopeWithImports : LexicalScope ): BindingContext =
51- classPath.compiler.compileKtExpression(expression, scopeWithImports, sourcePath, kind).first
50+ fun bindingContextOf (expression : KtExpression , scopeWithImports : LexicalScope ): BindingContext ? =
51+ classPath.compiler.compileKtExpression(expression, scopeWithImports, sourcePath, kind)? .first
5252
5353 private fun expandForType (cursor : Int , surroundingExpr : KtExpression ): KtExpression {
5454 val dotParent = surroundingExpr.parent as ? KtDotQualifiedExpression
@@ -73,7 +73,7 @@ class CompiledFile(
7373 val scope = scopeAtPoint(cursor) ? : return nullResult(" Couldn't find scope at ${describePosition(cursor)} " )
7474 // NOTE: Due to our tiny-fake-file mechanism, we may have `path == /dummy.virtual.kt != parse.containingFile.toPath`
7575 val path = surroundingExpr.containingFile.toPath()
76- val context = bindingContextOf(surroundingExpr, scope)
76+ val context = bindingContextOf(surroundingExpr, scope) ? : return null
7777 LOG .info(" Hovering {}" , surroundingExpr)
7878 return referenceFromContext(cursor, path, context)
7979 }
0 commit comments