private @NotNull ModTemplateBuilder createField(@NotNull PsiElement element, @Nullable String varName, @NotNull Expression expression) {
          TextRange elementRange = getRange(element);
          if (elementRange == null) {
            throw new IllegalStateException("Unable to restore element for template");
          }
          TextRange range = mapRange(elementRange);
          Result result = expression.calculateResult(new DummyContext(range, element));
          myTemplateFields.add(new ModStartTemplate.ExpressionField(range, varName, expression));
          if (result != null) {
            myTracker.myDocument.replaceString(elementRange.getStartOffset(), elementRange.getEndOffset(), result.toString());
          }
          return this;
        }
private @NotNull ModTemplateBuilder createField(@NotNull PsiElement element, @Nullable String varName, @NotNull Expression expression)