/** * @license * Copyright 2022-2026 Matter.js Authors * SPDX-License-Identifier: Apache-2.0 */ import { Model } from "../models/Model.js"; import { ValueModel } from "../models/ValueModel.js"; import { Scope } from "./Scope.js"; /** * Defines the names and locations for objects in a specific scope. * * We compute this information before interacting with the scope so we can resolve any name collisions in deference to * the most logical definition. * * We do not worry about Tlv* prefixed names as these are not prone to collision. */ export interface GeneratorScope { /** * The model that defines this scope. */ owner: Model; /** * The associated model scope. */ scope: Scope; /** * Obtain the name to use for an in-scope model. * * Throws an error if the model is not assessed as in-scope. * * @param model the model to name * @param tlv structs have both Name and TlvName defined; this selects the latter * @param specific if true retrieves the name for this specific model rather than any canonical override */ nameFor(model: Model, tlv?: boolean, specific?: boolean): string; /** * Obtain the location of a model's definition. * * Throws an error if the model is not referenced in this scope. * * @param model the model whose location we load * @param specific if true retrieves the name for this specific model rather than any canonical override */ locationOf(model: Model, specific?: boolean): GeneratorScope.Location; /** * Obtain the canonical model for a definition. * * This is the input model unless the model is redefined in a derived scope in which case it is the override. */ canonicalModelFor(model: T): T; /** * Given a model, find the canonical model that defines fields for the model. This will be the generated model we * need to reference. */ definingModelFor(model: ValueModel): ValueModel | undefined; /** * Iterate all named models with their assigned names and locations. */ namedModels(): Iterable<[model: Model, name: string, location: GeneratorScope.Location]>; } export declare namespace GeneratorScope { /** * The canonical location of a model. */ interface Location { /** * The scope that owns the defining model. */ scope: Model; /** * The defining model. */ definition: Model; /** * True iff the model is owned by this scope. */ isLocal: boolean; /** * True iff the model is owned by the root Matter element. */ isGlobal: boolean; } } /** * Obtain the codegen scope for a model. * * Scopes are cached so this should not be used with models that may mutate. */ export declare function GeneratorScope(model: Model | GeneratorScope): GeneratorScope; //# sourceMappingURL=GeneratorScope.d.ts.map