From 235b03c4072690c3ee7a4331be75c75a8e737fc2 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 7 May 2014 22:10:21 +0400 Subject: [PATCH] Minor in JS backend: added useful message to assert(for EA-48931) and drop unnecessary code. --- .../translate/expression/ExpressionVisitor.java | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/js/js.translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java b/js/js.translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java index 01b9698ab03..52689c4871a 100644 --- a/js/js.translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java +++ b/js/js.translator/src/org/jetbrains/k2js/translate/expression/ExpressionVisitor.java @@ -20,7 +20,6 @@ import com.google.dart.compiler.backend.js.ast.*; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.jetbrains.jet.JetNodeTypes; import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor; import org.jetbrains.jet.lang.descriptors.FunctionDescriptor; import org.jetbrains.jet.lang.descriptors.VariableDescriptor; @@ -72,18 +71,7 @@ public final class ExpressionVisitor extends TranslatorVisitor { private static JsNode translateConstantExpression(@NotNull JetConstantExpression expression, @NotNull TranslationContext context) { CompileTimeConstant compileTimeValue = context.bindingContext().get(BindingContext.COMPILE_TIME_VALUE, expression); - // TODO: workaround for default parameters translation. Will be fixed later. - // public fun parseInt(s: String, radix:Int = 10): Int = js.noImpl - if (compileTimeValue == null) { - if (expression.getNode().getElementType() == JetNodeTypes.BOOLEAN_CONSTANT) { - return JsLiteral.getBoolean(Boolean.valueOf(expression.getText())); - } - else if (expression.getNode().getElementType() == JetNodeTypes.INTEGER_CONSTANT) { - return context.program().getNumberLiteral(Integer.parseInt(expression.getText())); - } - } - - assert compileTimeValue != null; + assert compileTimeValue != null : message(expression, "Expression is not compile time value: " + expression.getText() + " "); if (compileTimeValue instanceof NullValue) { return JsLiteral.NULL;