Skip to content

Commit

Permalink
optimization of constant expressions. will be useful only when fronte…
Browse files Browse the repository at this point in the history
…nd does good job
  • Loading branch information
alextkachman committed Aug 3, 2012
1 parent 2df3041 commit 40d98dc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ public StackValue genQualified(StackValue receiver, JetElement selector) {
}

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);
}

Expand Down

0 comments on commit 40d98dc

Please sign in to comment.