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

## Statements: 100% (16 / 16) Branches: 100% (2 / 2) Functions: 100% (3 / 3) Lines: 100% (16 / 16) Ignored: none

All files » lib/parser/ast/ » call.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
    33
    341

    1
    108
    108
    108

    1

    22

    22

    22
    1
    2

    21

    22

    22

    22

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

    function CallExpression (reference, parameters) {
      this.reference  = reference;
      this.parameters = parameters;
      BaseExpression.apply(this, arguments);
    }

    BaseExpression.extend(CallExpression, {
      type: "call",
      toJavaScript: function () {

        var path = this.reference.path.concat(),
        fnName   = path.pop();

        var buffer = "this.call(";

        if (path.length) {
          buffer += "this.get([" + path.map(function (name) {
            return "\"" + name + "\"";
          }).join(",") + "])"
        } else {
          buffer += "this.context"
        }

        buffer += ", \"" + fnName + "\"";

        buffer += ", [" + this.parameters.toJavaScript() + "]"

        return buffer + ")"
      }
    });

    module.exports = CallExpression;