'use strict';

var grammarUtils = require('../utils/grammar-utils.js');

/******************************************************************************
 * Copyright 2021 TypeFox GmbH
 * This program and the accompanying materials are made available under the
 * terms of the MIT License, which is available in the project root.
 ******************************************************************************/
function isNamed(node) {
    return typeof node.name === 'string';
}
class DefaultNameProvider {
    getName(node) {
        if (isNamed(node)) {
            return node.name;
        }
        return undefined;
    }
    getNameNode(node) {
        return grammarUtils.findNodeForProperty(node.$cstNode, 'name');
    }
}

exports.DefaultNameProvider = DefaultNameProvider;
exports.isNamed = isNamed;
