/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
/**
 * Get a field from `node`, optionally modifying the tree to create it if missing.
 */
export function getMapTreeField(node, key, createIfMissing) {
    const field = node.fields.get(key);
    if (field !== undefined) {
        return field;
    }
    // Handle missing field:
    if (createIfMissing === false) {
        return [];
    }
    const newField = [];
    node.fields.set(key, newField);
    return newField;
}
//# sourceMappingURL=mapTree.js.map