Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 47 additions & 3 deletions dist/datamodel/parser/ScCatalog.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,26 @@ export declare function scXmlWithRenames(xml: string, renames: ReadonlyMap<strin
* of two names lands as a swap.
*/
export declare function scJsonTextWithRenames(text: string, renames: ReadonlyMap<string, string>, functionRenames?: CatalogFunctionRenames): string;
/** One function of a service interface definition, as the source text spells it. */
export interface ScFunction {
/** The interface's name in the source text. */
interfaceName: string;
/** The function's name in the source text: the text at `nameSite`. */
name: string;
/** Where the function's own `p_Name` value is written. */
nameSite: ScNameSite;
/**
* Where the function's own `p_FunctionPrototype` value is written. Null when the function
* has no Prototype text to rename.
*/
prototypeSite: ScNameSite | null;
}
/**
* Every function of the catalog renamed since it was read: interface name in the file ->
* (function name in the file -> function name now). The interface is keyed by its name in
* the FILE, so a function rename and a rename of its interface, in either order, both land.
* Function renames to carry into a catalog: interface name -> (function name -> new function
* name), both keyed by the names the catalog text being edited spells. The session's own record
* keeps them keyed by the names in the FILE as read, so a function rename and a rename of its
* interface, in either order, both land at save; a host that carries one rename into its open
* text keys by the names that text spells now.
*/
export type CatalogFunctionRenames = ReadonlyMap<string, ReadonlyMap<string, string>>;
/**
Expand All @@ -191,4 +207,32 @@ export declare function catalogFunctionRenames(catalog: SystemComposerCatalog |
* setter follows (Simulink.FunctionElement.md), shared by the node and the catalog's copy.
*/
export declare function renamedPrototype(prototype: unknown, from: string, to: string): string | null;
/**
* The edits that carry the function renames into a catalog part: each renamed function's
* `p_Name`, and its `p_FunctionPrototype` where that declares the function by the name in the
* file. A Prototype in another form keeps its text; the name still moves.
*
* `text` is the text `fns` was scanned from (`scanScJsonFunctions` for a textual dictionary's
* whole JSON, `scanScXmlFunctions` for a binary one's catalog member), and `renames` is keyed
* by the names that text spells: interface name -> (function name -> new name). The edits are
* spans of that text, for `applyScEdits`, in scan order rather than ascending position
* (`applyScEdits` sorts them). What both save writers apply; public, like `scRenameEdits`, for
* a host that edits its open document in place.
*/
export declare function scFunctionRenameEdits(text: string, fns: ScFunction[], renames: CatalogFunctionRenames): ScTextEdit[];
/**
* The functions of every service interface definition in a compressed-binary dictionary's
* catalog member: the same tag walk as `scanScXml`, reading a definition's direct-child
* `p_FunctionElements` and, in each, its own direct-child `p_Name` and `p_FunctionPrototype`.
* Empty for a member with no service interface.
*/
export declare function scanScXmlFunctions(xml: string): ScFunction[];
/**
* The functions of every service interface definition in an uncompressed-text dictionary's
* whole JSON text, the text twin of `scanScXmlFunctions`: each interface definition's
* `content.p_FunctionElements`, and in each function its `content.p_Name` and
* `content.p_FunctionPrototype`. Empty for a dictionary with no service interface in its
* interface dictionary part, or with no such part.
*/
export declare function scanScJsonFunctions(text: string): ScFunction[];
//# sourceMappingURL=ScCatalog.d.ts.map
2 changes: 1 addition & 1 deletion dist/datamodel/parser/ScCatalog.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 30 additions & 14 deletions dist/datamodel/parser/ScCatalog.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/datamodel/parser/ScCatalog.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export { scanSldd, type SlddScanResult } from './datamodel/parser/SlddScan.js';
export { scanMat, type MatScanResult } from './datamodel/parser/MatScan.js';
export { scanModelStructure, type ModelStructure } from './datamodel/parser/ModelStructureScan.js';
export { DATA_PART, DATA_PART_XML, DATA_PART_KEY, TEXT_PARTS, TEXT_CONTENT } from './datamodel/parser/SlddParts.js';
export { SC_PART, SC_PART_XML, SC_TYPE_TO_CLASSIFICATION, applyScEdits, catalogFromDefinitions, classificationOf, scRenameEdits, scanScJsonText, scanScXml, } from './datamodel/parser/ScCatalog.js';
export type { ScDefinition, ScNameSite, ScTextEdit, SystemComposerCatalog } from './datamodel/parser/ScCatalog.js';
export { SC_PART, SC_PART_XML, SC_TYPE_TO_CLASSIFICATION, applyScEdits, catalogFromDefinitions, classificationOf, scFunctionRenameEdits, scRenameEdits, scanScJsonFunctions, scanScJsonText, scanScXml, scanScXmlFunctions, } from './datamodel/parser/ScCatalog.js';
export type { CatalogFunctionRenames, ScDefinition, ScFunction, ScNameSite, ScTextEdit, SystemComposerCatalog, } from './datamodel/parser/ScCatalog.js';
export { buildUsageIndex, buildUsageIndexFromSummaries, mergeFileSummaries, summarizeFiles, summarizeParsedModel, summarizeSlddScan, summarizeMatScan, resolveName, } from './datamodel/usage/UsageIndex.js';
export type { UsageIndex, UsageFile, FileSummaries, ModelSummary, DataSummary, ParamOrigin, OriginKind, } from './datamodel/usage/UsageIndex.js';
export { maskDefining } from './datamodel/maskScope.js';
Expand Down
Loading
Loading