JvmDeclarationOrigin used in FunctionCodegen.generateMethod()
This commit is contained in:
@@ -162,7 +162,7 @@ public class ClosureCodegen extends ParentCodegenAware {
|
||||
generateBridge(cv, typeMapper.mapSignature(erasedInterfaceFunction).getAsmMethod(), jvmMethodSignature.getAsmMethod());
|
||||
|
||||
FunctionCodegen fc = new FunctionCodegen(context, cv, state, getParentCodegen());
|
||||
fc.generateMethod(fun, jvmMethodSignature, funDescriptor, strategy);
|
||||
fc.generateMethod(OtherOrigin(fun, funDescriptor), jvmMethodSignature, funDescriptor, strategy);
|
||||
|
||||
this.constructor = generateConstructor(cv, superClassAsmType);
|
||||
|
||||
|
||||
@@ -100,7 +100,8 @@ public class FunctionCodegen extends ParentCodegenAware {
|
||||
JvmMethodSignature method = typeMapper.mapSignature(functionDescriptor, kind);
|
||||
|
||||
if (kind != OwnerKind.TRAIT_IMPL || function.hasBody()) {
|
||||
generateMethod(function, method, functionDescriptor,
|
||||
generateMethod(OtherOrigin(function, functionDescriptor),
|
||||
method, functionDescriptor,
|
||||
new FunctionGenerationStrategy.FunctionDefault(state, functionDescriptor, function));
|
||||
}
|
||||
|
||||
@@ -109,7 +110,7 @@ public class FunctionCodegen extends ParentCodegenAware {
|
||||
}
|
||||
|
||||
public void generateMethod(
|
||||
@Nullable PsiElement origin,
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
@NotNull JvmMethodSignature jvmSignature,
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull FunctionGenerationStrategy strategy
|
||||
@@ -118,7 +119,7 @@ public class FunctionCodegen extends ParentCodegenAware {
|
||||
}
|
||||
|
||||
public void generateMethod(
|
||||
@Nullable PsiElement origin,
|
||||
@NotNull JvmDeclarationOrigin origin,
|
||||
@NotNull JvmMethodSignature jvmSignature,
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull MethodContext methodContext,
|
||||
@@ -127,7 +128,7 @@ public class FunctionCodegen extends ParentCodegenAware {
|
||||
OwnerKind methodContextKind = methodContext.getContextKind();
|
||||
Method asmMethod = jvmSignature.getAsmMethod();
|
||||
|
||||
MethodVisitor mv = v.newMethod(OtherOrigin(origin, functionDescriptor),
|
||||
MethodVisitor mv = v.newMethod(origin,
|
||||
getMethodAsmFlags(functionDescriptor, methodContextKind),
|
||||
asmMethod.getName(),
|
||||
asmMethod.getDescriptor(),
|
||||
@@ -163,7 +164,7 @@ public class FunctionCodegen extends ParentCodegenAware {
|
||||
|
||||
generateMethodBody(mv, functionDescriptor, methodContext, jvmSignature, strategy, getParentCodegen());
|
||||
|
||||
endVisit(mv, null, origin);
|
||||
endVisit(mv, null, origin.getElement());
|
||||
|
||||
methodContext.recordSyntheticAccessorIfNeeded(functionDescriptor, bindingContext);
|
||||
|
||||
|
||||
@@ -786,7 +786,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
@Override
|
||||
public void generateComponentFunction(@NotNull FunctionDescriptor function, @NotNull final ValueParameterDescriptor parameter) {
|
||||
functionCodegen.generateMethod(myClass, typeMapper.mapSignature(function), function, new FunctionGenerationStrategy() {
|
||||
functionCodegen.generateMethod(OtherOrigin(myClass, function), typeMapper.mapSignature(function), function, new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
@NotNull MethodVisitor mv,
|
||||
@@ -812,7 +812,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
final Type thisDescriptorType = typeMapper.mapType(descriptor);
|
||||
|
||||
functionCodegen.generateMethod(myClass, methodSignature, function, new FunctionGenerationStrategy() {
|
||||
functionCodegen.generateMethod(OtherOrigin(myClass, function), methodSignature, function, new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
@NotNull MethodVisitor mv,
|
||||
@@ -941,7 +941,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
FunctionDescriptor bridge = (FunctionDescriptor) entry.getValue();
|
||||
final FunctionDescriptor original = (FunctionDescriptor) entry.getKey();
|
||||
functionCodegen.generateMethod(
|
||||
null, typeMapper.mapSignature(bridge), bridge,
|
||||
OtherOrigin(original), typeMapper.mapSignature(bridge), bridge,
|
||||
new FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, bridge) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
@@ -957,7 +957,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
PropertyGetterDescriptor getter = bridge.getGetter();
|
||||
assert getter != null;
|
||||
functionCodegen.generateMethod(null, typeMapper.mapSignature(getter), getter,
|
||||
functionCodegen.generateMethod(OtherOrigin(original.getGetter()), typeMapper.mapSignature(getter), getter,
|
||||
new FunctionGenerationStrategy.CodegenBased<PropertyGetterDescriptor>(state, getter) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
@@ -983,7 +983,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
PropertySetterDescriptor setter = bridge.getSetter();
|
||||
assert setter != null;
|
||||
|
||||
functionCodegen.generateMethod(null, typeMapper.mapSignature(setter), setter,
|
||||
functionCodegen.generateMethod(OtherOrigin(original.getSetter()), typeMapper.mapSignature(setter), setter,
|
||||
new FunctionGenerationStrategy.CodegenBased<PropertySetterDescriptor>(state, setter) {
|
||||
@Override
|
||||
public void doGenerateBody(@NotNull ExpressionCodegen codegen, @NotNull JvmMethodSignature signature) {
|
||||
@@ -1137,7 +1137,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
assert constructorDescriptor != null : "Constructor not found for class: " + descriptor;
|
||||
final JvmMethodSignature constructorSignature = typeMapper.mapSignature(constructorDescriptor);
|
||||
|
||||
functionCodegen.generateMethod(myClass, constructorSignature, constructorDescriptor, constructorContext,
|
||||
functionCodegen.generateMethod(OtherOrigin(myClass, constructorDescriptor), constructorSignature, constructorDescriptor, constructorContext,
|
||||
new FunctionGenerationStrategy.CodegenBased<ConstructorDescriptor>(state, constructorDescriptor) {
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -1449,7 +1449,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
private void generateDelegationToTraitImpl(@NotNull final FunctionDescriptor traitFun, @NotNull FunctionDescriptor inheritedFun) {
|
||||
functionCodegen.generateMethod(
|
||||
descriptorToDeclaration(bindingContext, traitFun),
|
||||
OtherOrigin(descriptorToDeclaration(bindingContext, traitFun), traitFun),
|
||||
typeMapper.mapSignature(inheritedFun),
|
||||
inheritedFun,
|
||||
new FunctionGenerationStrategy.CodegenBased<FunctionDescriptor>(state, inheritedFun) {
|
||||
|
||||
@@ -60,8 +60,7 @@ import org.jetbrains.org.objectweb.asm.Type;
|
||||
import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.codegen.AsmUtil.asmDescByFqNameWithoutInnerClasses;
|
||||
import static org.jetbrains.jet.codegen.CodegenPackage.PackageFacade;
|
||||
import static org.jetbrains.jet.codegen.CodegenPackage.PackagePart;
|
||||
import static org.jetbrains.jet.codegen.CodegenPackage.*;
|
||||
import static org.jetbrains.jet.descriptors.serialization.NameSerializationUtil.createNameResolver;
|
||||
import static org.jetbrains.jet.lang.resolve.java.PackageClassUtils.getPackageClassFqName;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
@@ -166,7 +165,7 @@ public class PackageCodegen {
|
||||
if (member instanceof DeserializedSimpleFunctionDescriptor) {
|
||||
DeserializedSimpleFunctionDescriptor function = (DeserializedSimpleFunctionDescriptor) member;
|
||||
JvmMethodSignature signature = state.getTypeMapper().mapSignature(function, OwnerKind.PACKAGE);
|
||||
memberCodegen.functionCodegen.generateMethod(null, signature, function,
|
||||
memberCodegen.functionCodegen.generateMethod(OtherOrigin(function), signature, function,
|
||||
new FunctionGenerationStrategy() {
|
||||
@Override
|
||||
public void generateBody(
|
||||
|
||||
@@ -303,7 +303,7 @@ public class PropertyCodegen {
|
||||
}
|
||||
|
||||
JvmMethodSignature signature = typeMapper.mapSignature(accessorDescriptor, kind);
|
||||
functionCodegen.generateMethod(accessor != null ? accessor : p, signature, accessorDescriptor, strategy);
|
||||
functionCodegen.generateMethod(OtherOrigin(accessor != null ? accessor : p, accessorDescriptor), signature, accessorDescriptor, strategy);
|
||||
}
|
||||
|
||||
private static int indexOfDelegatedProperty(@NotNull JetProperty property) {
|
||||
|
||||
Reference in New Issue
Block a user