Minor. Extract method for annotations resolution on expression
This commit is contained in:
+8
-4
@@ -1529,10 +1529,7 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
}
|
||||
|
||||
public KotlinTypeInfo visitAnnotatedExpression(KtAnnotatedExpression expression, ExpressionTypingContext context, boolean isStatement) {
|
||||
if (!(expression.getBaseExpression() instanceof KtObjectLiteralExpression)) {
|
||||
// annotations on object literals are resolved later inside LazyClassDescriptor
|
||||
components.annotationResolver.resolveAnnotationsWithArguments(context.scope, expression.getAnnotationEntries(), context.trace);
|
||||
}
|
||||
resolveAnnotationsOnExpression(expression, context);
|
||||
|
||||
KtExpression baseExpression = expression.getBaseExpression();
|
||||
if (baseExpression == null) {
|
||||
@@ -1541,6 +1538,13 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
|
||||
return facade.getTypeInfo(baseExpression, context, isStatement);
|
||||
}
|
||||
|
||||
protected void resolveAnnotationsOnExpression(KtAnnotatedExpression expression, ExpressionTypingContext context) {
|
||||
if (!(expression.getBaseExpression() instanceof KtObjectLiteralExpression)) {
|
||||
// annotations on object literals are resolved later inside LazyClassDescriptor
|
||||
components.annotationResolver.resolveAnnotationsWithArguments(context.scope, expression.getAnnotationEntries(), context.trace);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public KotlinTypeInfo visitKtElement(@NotNull KtElement element, ExpressionTypingContext context) {
|
||||
context.trace.report(UNSUPPORTED.on(element, getClass().getCanonicalName()));
|
||||
|
||||
+1
-4
@@ -309,10 +309,7 @@ public class ExpressionTypingVisitorForStatements extends ExpressionTypingVisito
|
||||
contextWithExpectedType.replaceExpectedType(NO_EXPECTED_TYPE).replaceScope(scope).replaceContextDependency(INDEPENDENT);
|
||||
KtExpression leftOperand = expression.getLeft();
|
||||
if (leftOperand instanceof KtAnnotatedExpression) {
|
||||
// We will lose all annotations during deparenthesizing, so we have to resolve them right now
|
||||
components.annotationResolver.resolveAnnotationsWithArguments(
|
||||
scope, ((KtAnnotatedExpression) leftOperand).getAnnotationEntries(), context.trace
|
||||
);
|
||||
basic.resolveAnnotationsOnExpression((KtAnnotatedExpression) leftOperand, context);
|
||||
}
|
||||
KtExpression left = deparenthesize(leftOperand);
|
||||
KtExpression right = expression.getRight();
|
||||
|
||||
Reference in New Issue
Block a user