All files / vsl/parser/nodes identifier.js

75% Statements 3/4
100% Branches 0/0
66.67% Functions 2/3
75% Lines 3/4
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                                      192x     192x                   17x    
import Node from './node';
import Id from '../../scope/scopeItem';
 
/**
 * Wraps a identifier.
 * 
 * Identifiers are specified by the tokenizer but this serves just as a class
 *  which is used for the parser
 * 
 */
export default class Identifier extends Node {
    
    /**
     * Creates an identifier
     * 
     * @param {string} identifier the identifier
     * @param {Object} position a position from nearley
     */
    constructor (identifier: string, position: Object) {
        super(position);
        
        /** @type {string} */
        this.identifier = new Id(identifier, null);
    }
    
    /** @override */
    get children() {
        return null;
    }
    
    /** @override */
    toString() {
        return this.identifier.rootId;
    }
}