TODO fix: Remove dead code.

Use util method in CallType
This commit is contained in:
pTalanov
2012-02-29 17:07:27 +04:00
parent d41515765e
commit f8673ceb79
2 changed files with 4 additions and 21 deletions
@@ -27,9 +27,9 @@ import org.jetbrains.jet.lang.psi.JetQualifiedExpression;
import org.jetbrains.jet.lang.psi.JetSafeQualifiedExpression;
import org.jetbrains.k2js.translate.context.TemporaryVariable;
import org.jetbrains.k2js.translate.context.TranslationContext;
import org.jetbrains.k2js.translate.utils.TranslationUtils;
import static com.google.dart.compiler.util.AstUtil.newSequence;
import static org.jetbrains.k2js.translate.utils.JsAstUtils.inequality;
/**
* @author Pavel Talanov
@@ -42,11 +42,10 @@ public enum CallType {
@NotNull TranslationContext context) {
assert receiver != null;
TemporaryVariable temporaryVariable = context.declareTemporary(receiver);
JsBinaryOperation notNullCheck = TranslationUtils.notNullCheck(context, temporaryVariable.reference());
JsNullLiteral nullLiteral = context.program().getNullLiteral();
//TODO: find similar not null checks
JsBinaryOperation notNullCheck = inequality(temporaryVariable.reference(), nullLiteral);
JsConditional callMethodIfNotNullElseNull =
new JsConditional(notNullCheck, constructor.construct(temporaryVariable.reference()), nullLiteral);
JsExpression methodCall = constructor.construct(temporaryVariable.reference());
JsConditional callMethodIfNotNullElseNull = new JsConditional(notNullCheck, methodCall, nullLiteral);
return newSequence(temporaryVariable.assignmentExpression(), callMethodIfNotNullElseNull);
}
},
@@ -73,14 +73,6 @@ public final class TranslationUtils {
return Translation.translateAsExpression(jetExpression, context);
}
//TODO: refactor backing field reference generation to use the generic way
@NotNull
public static JsNameRef backingFieldReference(@NotNull TranslationContext context,
@NotNull JetProperty expression) {
PropertyDescriptor propertyDescriptor = getPropertyDescriptor(context.bindingContext(), expression);
return backingFieldReference(context, propertyDescriptor);
}
@NotNull
public static JsNameRef backingFieldReference(@NotNull TranslationContext context,
@NotNull PropertyDescriptor descriptor) {
@@ -166,14 +158,6 @@ public final class TranslationUtils {
return Translation.translateAsExpression(baseExpression, context);
}
//TODO:
@NotNull
public static JsExpression translateReceiver(@NotNull TranslationContext context,
@NotNull JetDotQualifiedExpression expression) {
return Translation.translateAsExpression(expression.getReceiverExpression(), context);
}
@NotNull
public static JsExpression translateLeftExpression(@NotNull TranslationContext context,
@NotNull JetBinaryExpression expression) {