Code coverage report for src/ast/unary.js

Statements: 81.25% (13 / 16)      Branches: 75% (3 / 4)      Functions: 100% (2 / 2)      Lines: 81.25% (13 / 16)      Ignored: none     

All files » src/ast/ » unary.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 34 35 36 37              1 1                 1 10 10 10     1 10 3 3 3 7             1  
/*!
 * Copyright (C) 2017 Glayzzle (BSD3 License)
 * @authors https://github.com/glayzzle/php-parser/graphs/contributors
 * @url http://glayzzle.com
 */
"use strict";
 
var Operation = require('./operation');
var KIND = 'unary';
 
/**
 * Unary operations
 * @constructor Unary
 * @extends {Operation}
 * @property {String} type
 * @property {Expression} what
 */
var Unary = Operation.extends(function Unary(type, what, location) {
  Operation.apply(this, [KIND, location]);
  this.type = type;
  this.what = what;
});
 
Unary.prototype.precedence = function(node) {
  if (node.kind === 'bin') {
    this.what = node.left;
    node.left = this;
    return node;
  } else Iif (node.kind === 'retif') {
    this.what = node.test;
    node.test = this;
    return node;
  }
};
 
module.exports = Unary;