From 1066fc7f2aa81d1d0ef5467b732cd2e00399ab6f Mon Sep 17 00:00:00 2001 From: "Natalia.Ukhorskaya" Date: Thu, 25 Jul 2013 14:51:08 +0400 Subject: [PATCH] Minor refactoring: rename methods --- .../src/org/jetbrains/jet/codegen/AnnotationCodegen.java | 8 ++++---- .../src/org/jetbrains/jet/codegen/PropertyCodegen.java | 6 ++---- .../jetbrains/jet/lang/resolve/AnnotationResolver.java | 8 ++++++-- .../src/org/jetbrains/jet/lang/resolve/BodyResolver.java | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/AnnotationCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/AnnotationCodegen.java index e7a66617395..c95f1602af3 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/AnnotationCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/AnnotationCodegen.java @@ -91,7 +91,7 @@ public abstract class AnnotationCodegen { public void generateAnnotationDefaultValue(CompileTimeConstant value) { AnnotationVisitor visitor = visitAnnotation(null, false); // Parameters are unimportant - genAnnotationArgument(null, value, visitor); + genCompileTimeValue(null, value, visitor); visitor.visitEnd(); } @@ -113,11 +113,11 @@ public abstract class AnnotationCodegen { for (Map.Entry> entry : annotationDescriptor.getAllValueArguments().entrySet()) { ValueParameterDescriptor descriptor = entry.getKey(); String name = descriptor.getName().asString(); - genAnnotationArgument(name, entry.getValue(), annotationVisitor); + genCompileTimeValue(name, entry.getValue(), annotationVisitor); } } - private void genAnnotationArgument( + private void genCompileTimeValue( @Nullable final String name, @NotNull CompileTimeConstant value, @NotNull final AnnotationVisitor annotationVisitor @@ -179,7 +179,7 @@ public abstract class AnnotationCodegen { public Void visitArrayValue(ArrayValue value, Void data) { AnnotationVisitor visitor = annotationVisitor.visitArray(name); for (CompileTimeConstant argument : value.getValue()) { - genAnnotationArgument(null, argument, visitor); + genCompileTimeValue(null, argument, visitor); } visitor.visitEnd(); return null; diff --git a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java index e114b06476b..ecaa0b50ad0 100644 --- a/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java +++ b/compiler/backend/src/org/jetbrains/jet/codegen/PropertyCodegen.java @@ -106,12 +106,10 @@ public class PropertyCodegen extends GenerationStateAware { public void generateConstructorPropertyAsMethodForAnnotationClass(JetParameter p, PropertyDescriptor descriptor) { Type type = state.getTypeMapper().mapType(descriptor); - MethodVisitor visitor = - v.newMethod(p, ACC_PUBLIC | ACC_ABSTRACT, p.getName(), "()" + type.getDescriptor(), null, null); + MethodVisitor visitor = v.newMethod(p, ACC_PUBLIC | ACC_ABSTRACT, p.getName(), "()" + type.getDescriptor(), null, null); JetExpression defaultValue = p.getDefaultValue(); if (defaultValue != null) { - CompileTimeConstant constant = - state.getBindingContext().get(BindingContext.COMPILE_TIME_VALUE, defaultValue); + CompileTimeConstant constant = state.getBindingContext().get(BindingContext.COMPILE_TIME_VALUE, defaultValue); assert constant != null : "Default value for annotation parameter should be compile time value: " + defaultValue.getText(); AnnotationCodegen annotationCodegen = AnnotationCodegen.forAnnotationDefaultValue(visitor, typeMapper); annotationCodegen.generateAnnotationDefaultValue(constant); diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java index 08060d35ad3..44e1e4e7da7 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/AnnotationResolver.java @@ -213,7 +213,7 @@ public class AnnotationResolver { for (ValueArgument argument : resolvedValueArgument.getArguments()) { JetExpression argumentExpression = argument.getArgumentExpression(); if (argumentExpression != null) { - CompileTimeConstant constant = resolveAnnotationArgument(argumentExpression, expectedType, trace); + CompileTimeConstant constant = resolveExpressionToCompileTimeValue(argumentExpression, expectedType, trace); if (constant != null) { constants.add(constant); } @@ -223,7 +223,11 @@ public class AnnotationResolver { } @Nullable - public CompileTimeConstant resolveAnnotationArgument(@NotNull JetExpression expression, @NotNull final JetType expectedType, final BindingTrace trace) { + public CompileTimeConstant resolveExpressionToCompileTimeValue( + @NotNull JetExpression expression, + @NotNull final JetType expectedType, + @NotNull final BindingTrace trace + ) { JetVisitor, Void> visitor = new JetVisitor, Void>() { @Override public CompileTimeConstant visitConstantExpression(JetConstantExpression expression, Void nothing) { diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java index 39a64e34cf7..dee4c9d5605 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/BodyResolver.java @@ -699,7 +699,7 @@ public class BodyResolver { expressionTypingServices.getType(declaringScope, defaultValue, valueParameterDescriptor.getType(), DataFlowInfo.EMPTY, trace); if (DescriptorUtils.isAnnotationClass(DescriptorUtils.getContainingClass(declaringScope))) { CompileTimeConstant constant = - annotationResolver.resolveAnnotationArgument(defaultValue, valueParameterDescriptor.getType(), trace); + annotationResolver.resolveExpressionToCompileTimeValue(defaultValue, valueParameterDescriptor.getType(), trace); if (constant != null) { trace.record(BindingContext.COMPILE_TIME_VALUE, defaultValue, constant); }