import { streamAllContents as e, streamContents as t } from "../utils/ast-utils.js";
import { cancellation_exports as n } from "../utils/cancellation.js";
import { interruptAndCheck as r } from "../utils/promise-utils.js";
import { MultiMap as i } from "../utils/collections.js";
//#region ../../node_modules/langium/lib/references/scope-computation.js
var a = class {
	constructor(e) {
		this.nameProvider = e.references.NameProvider, this.descriptions = e.workspace.AstNodeDescriptionProvider;
	}
	async collectExportedSymbols(e, t = n.CancellationToken.None) {
		return this.collectExportedSymbolsForNode(e.parseResult.value, e, void 0, t);
	}
	async collectExportedSymbolsForNode(e, i, a = t, o = n.CancellationToken.None) {
		let s = [];
		this.addExportedSymbol(e, s, i);
		for (let t of a(e)) await r(o), this.addExportedSymbol(t, s, i);
		return s;
	}
	addExportedSymbol(e, t, n) {
		let r = this.nameProvider.getName(e);
		r && t.push(this.descriptions.createDescription(e, r, n));
	}
	async collectLocalSymbols(t, a = n.CancellationToken.None) {
		let o = t.parseResult.value, s = new i();
		for (let n of e(o)) await r(a), this.addLocalSymbol(n, t, s);
		return s;
	}
	addLocalSymbol(e, t, n) {
		let r = e.$container;
		if (r) {
			let i = this.nameProvider.getName(e);
			i && n.add(r, this.descriptions.createDescription(e, i, t));
		}
	}
};
//#endregion
export { a as DefaultScopeComputation };
