Render the expression body of a branch method.
160799
private static void renderExpr(
      CodeBlock.Builder code, List<Node<PluralType>> rangeList, boolean equal, boolean decimalsZero) {
    
    int size = rangeList.size();
    String r = "";

    // Join the range list expressions with the OR operator.
    for (int i = 0; i < size; i++) {
      if (i > 0) {
        r += " || ";
      }
      r += renderRange("zz", rangeList.get(i));
    }

    // Wrap the expression in an IF.
    String fmt = "if (";
    if (decimalsZero) {
      fmt += "o.nd() != 0 || ";
    }

    if (equal) {
      fmt += size == 1 ? "!$L" : "!($L)";
    } else {
      fmt += "($L)";
    }

    fmt += ")";

    // Wrap the IF as a block.
    code.beginControlFlow(fmt, r);
    code.addStatement("return false");
    code.endControlFlow();
  }
802002
public void postProcess() {
    if (!this.isEmptySlot()) {

      switch (savedItem.getExpressionItemType()) {
        case OPERATOR: {
          if (savedItem == OPERATOR_SUB) {
            if (!childElements[0].isEmptySlot() && childElements[1].isEmptySlot()) {
              final ExpressionTreeElement left = childElements[0];
              final ExpressionItem item = left.getItem();
              if (item.getExpressionItemType() == ExpressionItemType.VALUE) {
                final Value val = (Value) item;
                switch (val.getType()) {
                  case INT: {
                    childElements = EMPTY;
                    savedItem = Value.valueOf(0 - val.asLong());
                    makeMaxPriority();
                  }
                  break;
                  case FLOAT: {
                    childElements = EMPTY;
                    savedItem = Value.valueOf(0.0f - val.asFloat());
                    makeMaxPriority();
                  }
                  break;
                  default: {
                    if (!left.isEmptySlot()) {
                      left.postProcess();
                    }
                  }
                  break;
                }
              }
            } else {
              for (final ExpressionTreeElement element : childElements) {
                if (!element.isEmptySlot()) {
                  element.postProcess();
                }
              }
            }
          } else {
            for (final ExpressionTreeElement element : childElements) {
              if (!element.isEmptySlot()) {
                element.postProcess();
              }
            }
          }
        }
        break;
        case FUNCTION: {
          for (final ExpressionTreeElement element : childElements) {
            if (!element.isEmptySlot()) {
              element.postProcess();
            }
          }
        }
        break;
      }
    }
  }
792053
function render(template, locals, layoutTemplates, cb) {
    if (!layoutTemplates) layoutTemplates = [];

    // We'll render templates from bottom to top of the stack, each template
    // being passed the rendered string of the previous ones as `body`
    var i = layoutTemplates.length - 1;

    var _stackRenderer = function(err, htmlStr) {
      if (err) return cb(err);

      if (i >= 0) {
        locals.body = htmlStr;
        renderTemplate(layoutTemplates[i--], locals, _stackRenderer);
      } else {
        cb(null, htmlStr);
      }
    };

    // Start the rendering with the innermost page template
    renderTemplate(template, locals, _stackRenderer);
  }
940077
public String render(Node root, boolean processExtendRoots) {
    OutputList output = new OutputList(config.getMaxOutputSize());

    for (Node node : root.getChildren()) {
      lineNumber = node.getLineNumber();
      position = node.getStartPosition();
      String renderStr = node.getMaster().getImage();
      if (context.doesRenderStackContain(renderStr)) {
        // This is a circular rendering. Stop rendering it here.
        addError(new TemplateError(ErrorType.WARNING, ErrorReason.EXCEPTION, ErrorItem.TAG,
            "Rendering cycle detected: '" + renderStr + "'", null, getLineNumber(), node.getStartPosition(),
            null, BasicTemplateErrorCategory.IMPORT_CYCLE_DETECTED, ImmutableMap.of("string", renderStr)));
        output.addNode(new RenderedOutputNode(renderStr));
      } else {
        OutputNode out;
        context.pushRenderStack(renderStr);
        try {
          out = node.render(this);
        } catch (DeferredValueException e) {
          out = new RenderedOutputNode(node.getMaster().getImage());
        }
        context.popRenderStack();
        output.addNode(out);
      }
    }

    // render all extend parents, keeping the last as the root output
    if (processExtendRoots) {
      while (!extendParentRoots.isEmpty()) {
        context.getCurrentPathStack().push(context.getExtendPathStack().peek().orElse(""), lineNumber, position);
        Node parentRoot = extendParentRoots.removeFirst();
        output = new OutputList(config.getMaxOutputSize());

        for (Node node : parentRoot.getChildren()) {
          OutputNode out = node.render(this);
          output.addNode(out);
        }

        context.getExtendPathStack().pop();
        context.getCurrentPathStack().pop();
      }
    }

    resolveBlockStubs(output);

    return output.getValue();
  }
29174
private SoyValue eval(ExprNode expr, SoyNode node) {

    if (expr == null) {
      throw RenderException.create("Cannot evaluate expression in V1 syntax.")
          .addStackTraceElement(node);
    }

    // Lazily initialize evalVisitor.
    if (evalVisitor == null) {
      evalVisitor =
          evalVisitorFactory.create(
              env,
              cssRenamingMap,
              xidRenamingMap,
              msgBundle,
              debugSoyTemplateInfo,
              pluginInstances);
    }

    try {
      return evalVisitor.exec(expr);
    } catch (RenderException e) {
      // RenderExceptions can be thrown when evaluating lazy transclusions.
      throw RenderException.createFromRenderException(
          "When evaluating \"" + expr.toSourceString() + "\": " + e.getMessage(), e, node);
    } catch (Exception e) {
      throw RenderException.createWithSource(
          "When evaluating \"" + expr.toSourceString() + "\": " + e.getMessage(), e, node);
    }
  }
698592
def _render_template(options)
        if options.delete(:stream)
          Rack::Chunked::Body.new view_renderer.render_body(view_context, options)
        else
          super
        end
      end
1152297
@Override
    public synchronized Renderable<?> render(Controller controller, Map<String, Object> variables) {
        HashMap<String, Object> map = new HashMap<>(variables);
        if (!map.containsKey(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY)) {
            map.put(ExtendedOGNLExpressionEvaluator.BUNDLE_VAR_KEY, bundle);
        }
        return templateEngine.process(this, controller, router, assets, map);
    }
720598
def render_body(context, options)
      if options.key?(:partial)
        [render_partial(context, options)]
      else
        StreamingTemplateRenderer.new(@lookup_context).render(context, options)
      end
    end
566043
private function renderSpoiled()
    {
        if (count($this->getSpoiledItems()) === 0) {
            $this->parts['{button}'] = '';

            return;
        }

        $method = 'renderButton' . Inflector::id2camel($this->mode);
        call_user_func([$this, $method]);
    }
404868
private void evaluateExpressions() throws JspException {
        if (dataSourceEL != null) {
            dataSource = ExpressionEvaluatorManager.evaluate
                    ("dataSource", dataSourceEL, Object.class, this, pageContext);
        }

        if (driverClassNameEL != null) {
            driverClassName = (String) ExpressionEvaluatorManager.evaluate
                    ("driver", driverClassNameEL, String.class, this, pageContext);
        }

        if (jdbcURLEL != null) {
            jdbcURL = (String) ExpressionEvaluatorManager.evaluate
                    ("url", jdbcURLEL, String.class, this, pageContext);
        }

        if (userNameEL != null) {
            userName = (String) ExpressionEvaluatorManager.evaluate
                    ("user", userNameEL, String.class, this, pageContext);
        }

        if (passwordEL != null) {
            password = (String) ExpressionEvaluatorManager.evaluate
                    ("password", passwordEL, String.class, this, pageContext);
        }
    }
282733
function() {
      var t = this,
          branchId = null,
          branches = t.model.get('branches'),
          leaves = t.model.get('leaves'),
          sortBy = _.isUndefined(t.options.sortBy) ? 'label' : t.options.sortBy,
          ordered = t.orderedNodes = [],
          elem,
          params = {};

      // Only render if something visual has changed.  The model
      // gets change events propagated up from sub-branches which
      // may not cause visual changes.
      var visualHash = t.getVisualHash();
      if (visualHash === t.visualHash) {
        return;
      }
      t.visualHash = visualHash;

      // Remove visual artifacts from this level down
      for (branchId in t.branchViews) {
        if (t.branchViews[branchId]) {
          t.branchViews[branchId].remove();
        }
      }
      t.branchViews = {};
      t.$el.html('');

      // Order the leaves & branches
      if (branches) {
        branches.forEach(function(node) {
          ordered.push({
            sortBy: node.get(sortBy) || node.get('id'),
            type: 'branch',
            node: node
          });
        });
      }
      if (leaves) {
        leaves.forEach(function(node) {
          ordered.push({
            sortBy: (node.get(sortBy) || '').toLowerCase(),
            type: 'leaf',
            node: node
          });
        });
      }
      if (sortBy) {
        ordered.sort(function(a,b) {
          var aVal = a.sortBy.toLowerCase ? a.sortBy.toLowerCase() : a.sortBy,
              bVal = b.sortBy.toLowerCase ? b.sortBy.toLowerCase() : b.sortBy;
          return aVal > bVal ? 1 : (aVal < bVal ? -1 : 0);
        });
      }

      // Output the ordered nodes
      ordered.forEach(function(orderedNode) {

        // Common parameters
        var node = orderedNode.node;
        params.id = node.get('id');
        params.label = node.get('label') || params.id;
        params.description = node.get('description');
        params.path = t.options.path + t.options.pathSeparator + params.id;

        // Leaves
        if (orderedNode.type === 'leaf') {
          elem = $(t.template.leaf(params)).appendTo(t.$el);
        }

        // Branches
        if (orderedNode.type === 'branch') {

          // Output the branch line
          var isOpen = node.get('isOpen');
          params.closed = isOpen ? '' : 'closed';
          params.caret = 'icon-caret-' + (isOpen ? 'down' : 'right');
          elem = $(t.template.branch(params))
            .appendTo(t.$el)
            .data('branch', node);

          // Attach a sub-TreeView to the branch
          var innerEl = $(t.template.inner({})).appendTo(t.$el);
          var treeView = new TreeView({
            model: node,
            parentView:t,
            monitorParams: t.options.monitorParams,
            path: params.path,
            pathSeparator: t.options.pathSeparator,
            preFetch: t.options.preFetch
          });
          treeView.render().appendTo(innerEl);

          // Remember inner branch view
          t.branchViews[params.id] = treeView;
        }

        // Add a tooltip for the description
        if (params.description) {
          UI.tooltip(elem, {placement:'right'});
        }
      });

      // Connect a monitor to this node
      t.connectMonitor();

      // For chaining
      return t.$el;
    }
408681
@Programmatic
    public String render(
            final String templateName,
            final String templateChars,
            final Object dataModel) throws IOException, TemplateException {
        return templateLoader
                .withTemplateSource(templateName, templateChars, new TemplateLoaderFromThreadLocal.Block() {
            @Override
            public String exec(final TemplateSource templateSource) throws IOException, TemplateException {
                final StringWriter sw = new StringWriter();
                final Template template = cfg.getTemplate(templateSource.getTemplateName());
                template.process(dataModel, sw);
                return sw.toString();
            }
        });
    }
240020
private void generateTemplateExpressionMethod(ComponentExposedTypeGenerator exposedTypeGenerator,
      TemplateExpression expression,
      String templateName) {
    MethodSpec.Builder templateExpressionMethodBuilder = MethodSpec
        .methodBuilder(expression.getId())
        .addModifiers(Modifier.PUBLIC)
        .addAnnotation(JsMethod.class)
        .addAnnotation(getUnusableByJSAnnotation())
        .returns(expression.getType());

    String expressionPosition = templateName;
    if (expression.getLineInHtml() != null) {
      expressionPosition += ", line " + expression.getLineInHtml();
    }

    templateExpressionMethodBuilder.addComment(expressionPosition);

    expression
        .getParameters()
        .forEach(parameter -> templateExpressionMethodBuilder.addParameter(parameter.getType(),
            parameter.getName()));

    if (expression.isReturnString()) {
      templateExpressionMethodBuilder.addStatement("return $T.templateExpressionToString($L)",
          VueGWTTools.class,
          expression.getBody());
    } else if (expression.isReturnVoid()) {
      templateExpressionMethodBuilder.addStatement("$L", expression.getBody());
    } else if (expression.isReturnAny()) {
      templateExpressionMethodBuilder.addStatement("return $T.asAny($L)",
          Js.class,
          expression.getBody());
    } else if (expression.isShouldCast()) {
      templateExpressionMethodBuilder.addStatement("return ($T) ($L)",
          expression.getType(),
          expression.getBody());
    } else {
      templateExpressionMethodBuilder.addStatement("return $L", expression.getBody());
    }

    exposedTypeGenerator.getClassBuilder().addMethod(templateExpressionMethodBuilder.build());
    exposedTypeGenerator.addMethodToProto(expression.getId());
  }
17424
def render(self, name, context):
        """"""
        if Generator.strict:
            self.env.undefined = TestableUndefined
        else:
            self.env.undefined = Undefined
        template = self.get_template(name)
        return template.render(context)
841245
private static void renderExpr(boolean first, CodeBlock.Builder code, Node<PluralType> expr) {
    Iterator<Node<PluralType>> iter = expr.asStruct().nodes().iterator();

    // Parse out the two forms of operand expressions we support:
    //
    //    n = <rangelist>
    //    n % m = <rangelist>
    //
    Atom<PluralType> operand = iter.next().asAtom();
    Atom<PluralType> modop = null;
    Atom<PluralType> relop = iter.next().asAtom();
    if (relop.type() == PluralType.MODOP) {
      modop = relop;
      relop = iter.next().asAtom();
    }

    String var = (String)operand.value();
    List<Node<PluralType>> rangeList = iter.next().asStruct().nodes();

    boolean decimalsZero = false;
    if (var.equals("n") && modop != null) {
      // We're applying mod to the 'n' operand, we must also ensure that
      // decimal value == 0.
      decimalsZero = true;
    }
    
    // If this is the first expression, define the variable; otherwise reuse it.
    String fmt = "zz = o.$L()";
    if (first) {
      fmt = "long " + fmt;
    }

    // Mod operations modify the operand before assignment.
    if (modop != null) {
      fmt += " % $LL";
    }

    // Emit the expression.
    if (modop != null) {
      code.addStatement(fmt, var, (int)modop.value());
    } else {
      code.addStatement(fmt, var);
    }

    renderExpr(code, rangeList, relop.value().equals("="), decimalsZero);
  }
1372350
final public ExecExpressionBuilder<T> exec() {
    final int sourceLineNumber = builder.getSourceLineNumber();
    return new ExecExpressionBuilder<T>(new ExpressionHandler<T>() {
      public T handleExpression(Expression e) {
        return statementHandler().handleStatement(new ExpressionStatement(sourceLineNumber, e));
      }
    });
  }
477956
private void evaluateExpressions() throws JspException {
        /* 
         * Note: we don't check for type mismatches here; we assume
         * the expression evaluator will return the expected type
         * (by virtue of knowledge we give it about what that type is).
         * A ClassCastException here is truly unexpected, so we let it
         * propagate up.
         */

        if (escapeXml_ != null) {
            Boolean b = (Boolean) ExpressionUtil.evalNotNull(
                    "out",
                    "escapeXml",
                    escapeXml_,
                    Boolean.class,
                    this,
                    pageContext);
            if (b == null) {
                escapeXml = false;
            } else {
                escapeXml = b.booleanValue();
            }
        }
    }