optimization of constant expressions. will be useful only when frontend does good job

This commit is contained in:
Alex Tkachman
2012-08-03 07:19:15 +03:00
parent 2df30416cd
commit 40d98dc7ef
@@ -177,6 +177,13 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
}
public StackValue gen(JetElement expr) {
if (expr instanceof JetExpression) {
JetExpression expression = (JetExpression) expr;
CompileTimeConstant<?> constant = bindingContext.get(BindingContext.COMPILE_TIME_VALUE, expression);
if (constant != null) {
return StackValue.constant(constant.getValue(), expressionType(expression));
}
}
return genQualified(StackValue.none(), expr);
}