All files / parser/nodes functionArgument.js

100% Statements 5/5
50% Branches 1/2
100% Functions 3/3
100% Lines 5/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                  18x     18x 18x         2x         1x    
import Node from './node';
 
/**
 * Represents a function argument
 */
 
export default class FunctionArgument extends Node {
    
    constructor(typedId: TypedIdentifier, defaultValue: Expression, position: Object) {
        super(position);
        
        /** @type {string} */
        this.typedId = typedId;
        this.defaultValue = defaultValue;
    }
    
    /** @override */
    get children() {
        return ['typedId', 'defaultValue'];
    }
    
    /** @override */
    toString() {
        return `${this.typedId}${this.defaultValue ? " = " + this.defaultValue : ""}`
    }
}