# Code coverage report for lib/parser/ast/rootNode.js

## Statements: 87.5% (14 / 16) Branches: 66.67% (4 / 6) Functions: 100% (2 / 2) Lines: 87.5% (14 / 16) Ignored: none

All files » lib/parser/ast/ » rootNode.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    331

    1
    369
    369

    1

    250

    250

    250
    250
    29
    221
    221

    250

    1
     var BaseExpression = require("./base");

    function RootExpression(children) {
      this.childNodes = children;
      BaseExpression.apply(this, arguments);
    }

    BaseExpression.extend(RootExpression, {
      type: "rootNode",
      toJavaScript: function() {

        var buffer = "(function(fragment, block, element, text, comment, parser, modifiers) { ";

        var element;

        Eif (this.childNodes.type === "array") {
          if (this.childNodes.expressions.expressions.length > 1) {
            element = "fragment(" + this.childNodes.toJavaScript() + ")";
          } else Eif (this.childNodes.expressions.expressions.length) {
            element = this.childNodes.expressions.expressions[0].toJavaScript();
          } else {
            return buffer + "})";
          }
        } else {
          element = this.childNodes.toJavaScript();
        }

        return buffer + "return " + element + "; })";
      }
    });

    module.exports = RootExpression;