Not recording names for SAM constructor calls since they are managed SamWrapperClasses.

This commit is contained in:
Evgeny Gerashchenko
2013-06-25 21:21:29 +04:00
parent 7660ae7f20
commit e58bd5b6ec
2 changed files with 1 additions and 29 deletions
@@ -27,7 +27,6 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.calls.model.ResolvedCall;
import org.jetbrains.jet.lang.resolve.java.JavaBindingContext;
import org.jetbrains.jet.lang.resolve.java.JvmAbi;
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
@@ -58,30 +57,6 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
this.bindingContext = bindingTrace.getBindingContext();
}
@Override
public void visitCallExpression(JetCallExpression expression) {
super.visitCallExpression(expression);
JetExpression callee = expression.getCalleeExpression();
assert callee != null : "not found callee for " + expression.getText();
ResolvedCall<? extends CallableDescriptor> resolvedCall = bindingContext.get(BindingContext.RESOLVED_CALL, callee);
if (resolvedCall == null) {
return;
}
DeclarationDescriptor funDescriptor = resolvedCall.getResultingDescriptor();
if (funDescriptor instanceof SimpleFunctionDescriptor) {
ClassDescriptor samTrait = bindingContext.get(
JavaBindingContext.SAM_CONSTRUCTOR_TO_INTERFACE, ((SimpleFunctionDescriptor) funDescriptor).getOriginal());
if (samTrait != null) {
String name = inventAnonymousClassName(expression);
bindingTrace.record(FQN_FOR_SAM_CONSTRUCTOR, expression, JvmClassName.byInternalName(name));
}
}
}
@NotNull
private ClassDescriptor recordClassForFunction(@NotNull FunctionDescriptor funDescriptor, @NotNull JetType superType) {
ClassDescriptor classDescriptor;
@@ -117,12 +92,11 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
if (declaration instanceof JetFunctionLiteralExpression ||
declaration instanceof JetNamedFunction ||
declaration instanceof JetObjectLiteralExpression ||
declaration instanceof JetCallExpression ||
declaration instanceof JetCallableReferenceExpression) {
}
else {
throw new IllegalStateException(
"Class-less declaration which is not JetFunctionLiteralExpression|JetNamedFunction|JetObjectLiteralExpression|JetCallExpression|JetCallableReferenceExpression : " +
"Class-less declaration which is not JetFunctionLiteralExpression|JetNamedFunction|JetObjectLiteralExpression|JetCallableReferenceExpression : " +
declaration.getClass().getName());
}
}
@@ -51,8 +51,6 @@ public class CodegenBinding {
public static final WritableSlice<DeclarationDescriptor, JvmClassName> FQN = Slices.createSimpleSlice();
public static final WritableSlice<JetCallExpression, JvmClassName> FQN_FOR_SAM_CONSTRUCTOR = Slices.createSimpleSlice();
public static final WritableSlice<JvmClassName, Boolean> SCRIPT_NAMES = Slices.createSimpleSetSlice();
public static final WritableSlice<ClassDescriptor, Boolean> ENUM_ENTRY_CLASS_NEED_SUBCLASS = Slices.createSimpleSetSlice();