All files / parser/nodes interfaceStatement.js

85.71% Statements 6/7
50% Branches 1/2
50% Functions 1/2
85.71% Lines 6/7
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 38 39 40 41 42 43 44 45 46                                                    38x     38x   38x   38x   38x   38x                
import Node from './node';
 
/**
 * Wraps an interfcae
 * 
 */
export default class InterfaceStatement extends Node {
 
    /**
     * Constructs a generic function statement
     * 
     * @param {string[]} access - The access modifiers of the node
     * @param {Identifier} name - The name of the interface
     * @param {Identifier[]} superclasses - The superclasses to inherit or implement
     * @param {Node[]} statements - The interface's body
     * @param {Annotation[]} annotations - The annotations of the interface
     * @param {Object} position - a position from nearley
     */
    constructor(
        access: string[],
        name: Identifier,
        superclasses: Identifier[],
        statements: Node[],
        annotations: Annotation[],
        position: Object
    ) {
        super(position);
 
        /** @type {string[]} */
        this.access = access;
        /** @type {Identifier} */
        this.name = name;
        /** @type {Identifier[]} */
        this.superclasses = superclasses;
        /** @type {Node[]} */
        this.statements = statements;
        /** @type {Annotation[]} */
        this.annotations = annotations || [];
    }
 
    /** @override */
    get children() {
        return ['name', 'superclasses', 'statements'];
    }
}