Minor, fix warnings in codegen

This commit is contained in:
Alexander Udalov
2013-09-26 20:14:38 +04:00
parent 54db0e30c0
commit ead8833a88
@@ -104,8 +104,8 @@ public abstract class ClassBodyCodegen extends MemberCodegen {
generatePrimaryConstructorProperties(propertyCodegen, myClass); generatePrimaryConstructorProperties(propertyCodegen, myClass);
} }
private boolean shouldProcessFirst(JetDeclaration declaration) { private static boolean shouldProcessFirst(JetDeclaration declaration) {
return false == (declaration instanceof JetProperty || declaration instanceof JetNamedFunction); return !(declaration instanceof JetProperty || declaration instanceof JetNamedFunction);
} }
@@ -163,7 +163,7 @@ public abstract class ClassBodyCodegen extends MemberCodegen {
} }
} }
@Nullable @NotNull
protected MethodVisitor createOrGetClInitMethod() { protected MethodVisitor createOrGetClInitMethod() {
if (clInitMethod == null) { if (clInitMethod == null) {
clInitMethod = v.newMethod(null, ACC_STATIC, "<clinit>", "()V", null, null); clInitMethod = v.newMethod(null, ACC_STATIC, "<clinit>", "()V", null, null);
@@ -171,22 +171,20 @@ public abstract class ClassBodyCodegen extends MemberCodegen {
return clInitMethod; return clInitMethod;
} }
@Nullable @NotNull
protected ExpressionCodegen createOrGetClInitCodegen() { protected ExpressionCodegen createOrGetClInitCodegen() {
assert state.getClassBuilderMode() == ClassBuilderMode.FULL; assert state.getClassBuilderMode() == ClassBuilderMode.FULL;
if (state.getClassBuilderMode() == ClassBuilderMode.FULL) { if (clInitCodegen == null) {
if (clInitCodegen == null) { MethodVisitor method = createOrGetClInitMethod();
MethodVisitor method = createOrGetClInitMethod(); method.visitCode();
method.visitCode(); SimpleFunctionDescriptorImpl clInit =
SimpleFunctionDescriptorImpl clInit = new SimpleFunctionDescriptorImpl(descriptor, Collections.<AnnotationDescriptor>emptyList(),
new SimpleFunctionDescriptorImpl(descriptor, Collections.<AnnotationDescriptor>emptyList(), Name.special("<clinit>"),
Name.special("<clinit>"), CallableMemberDescriptor.Kind.SYNTHESIZED);
CallableMemberDescriptor.Kind.SYNTHESIZED); clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(),
clInit.initialize(null, null, Collections.<TypeParameterDescriptor>emptyList(), Collections.<ValueParameterDescriptor>emptyList(), null, null, Visibilities.PRIVATE, false);
Collections.<ValueParameterDescriptor>emptyList(), null, null, Visibilities.PRIVATE, false);
clInitCodegen = new ExpressionCodegen(method, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state); clInitCodegen = new ExpressionCodegen(method, new FrameMap(), Type.VOID_TYPE, context.intoFunction(clInit), state);
}
} }
return clInitCodegen; return clInitCodegen;
} }