All files / parser/nodes functionCall.js

80% Statements 4/5
100% Branches 0/0
66.67% Functions 2/3
80% Lines 4/5
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                                    15x     15x     15x                   5x    
import Node from './node';
 
/**
 * Matches a function call inside a PropertyExpression
 * 
 * @example
 * head(argument)
 */
 
export default class FunctionCall extends Node {
    /**
     * Creates a function call
     * 
     * @param {Expression} head the function to call
     * @param {ArgumentCall[]} args the provided arguments
     * @param {Object} position a position from nearley
     */
    constructor (head: Expression, args: ArgumentCall[], position: Object) {
        super(position);
 
        /** @type {Expression} */
        this.head = head;
 
        /** @type {ArgumentCall[]} */
        this.arguments = args;
    }
    
    /** @override */
    get children () {
        return ['arguments'];
    }
    
    /** @override */
    toString() {
        return `${this.head}(${this.arguments.join(', ')})`;
    }
}