sysml-validate 0.20.3 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/main.js +96 -15
- package/out/main.js.map +2 -2
- package/package.json +1 -1
- package/resources/sysml.dimension-table.json +1 -1
package/out/main.js
CHANGED
|
@@ -59979,9 +59979,16 @@ function nameOf(node) {
|
|
|
59979
59979
|
const name = node?.name;
|
|
59980
59980
|
if (typeof name === "string" && name.length > 0)
|
|
59981
59981
|
return name;
|
|
59982
|
-
|
|
59983
|
-
|
|
59984
|
-
|
|
59982
|
+
const relational = node;
|
|
59983
|
+
for (const relationship of [
|
|
59984
|
+
...relational?.preRelationships ?? [],
|
|
59985
|
+
...relational?.relationships ?? []
|
|
59986
|
+
]) {
|
|
59987
|
+
if (relationship.kind !== ":>>" && relationship.kind !== "redefines")
|
|
59988
|
+
continue;
|
|
59989
|
+
const target = relationship.targets?.[0];
|
|
59990
|
+
if (target)
|
|
59991
|
+
return lastSegment2(target);
|
|
59985
59992
|
}
|
|
59986
59993
|
if (node?.$type === "FeatureShorthand") {
|
|
59987
59994
|
const text = node.$cstNode?.text;
|
|
@@ -59998,9 +60005,16 @@ function nameOf(node) {
|
|
|
59998
60005
|
return void 0;
|
|
59999
60006
|
}
|
|
60000
60007
|
function unwrap(node) {
|
|
60001
|
-
|
|
60002
|
-
|
|
60003
|
-
|
|
60008
|
+
let current2 = node;
|
|
60009
|
+
const seen = /* @__PURE__ */ new Set();
|
|
60010
|
+
while ((current2.$type === "PrefixMetadataMember" || current2.$type === "MemberPrefixDecl") && !seen.has(current2)) {
|
|
60011
|
+
seen.add(current2);
|
|
60012
|
+
const element = current2.element;
|
|
60013
|
+
if (!element)
|
|
60014
|
+
break;
|
|
60015
|
+
current2 = element;
|
|
60016
|
+
}
|
|
60017
|
+
return current2;
|
|
60004
60018
|
}
|
|
60005
60019
|
function directNamedChildren(node) {
|
|
60006
60020
|
const result = [];
|
|
@@ -60031,12 +60045,32 @@ function isSelfReference(candidate, node) {
|
|
|
60031
60045
|
function lastSegment2(path10) {
|
|
60032
60046
|
return path10.split(/::|\./u).pop() ?? path10;
|
|
60033
60047
|
}
|
|
60048
|
+
function simpleRelationName(path10) {
|
|
60049
|
+
let quoted = false;
|
|
60050
|
+
for (let index = 0; index < path10.length; index += 1) {
|
|
60051
|
+
const char = path10[index];
|
|
60052
|
+
if (quoted) {
|
|
60053
|
+
if (char === "\\")
|
|
60054
|
+
index += 1;
|
|
60055
|
+
else if (char === "'")
|
|
60056
|
+
quoted = false;
|
|
60057
|
+
continue;
|
|
60058
|
+
}
|
|
60059
|
+
if (char === "'")
|
|
60060
|
+
quoted = true;
|
|
60061
|
+
else if (char === "." || char === ":" && path10[index + 1] === ":")
|
|
60062
|
+
return void 0;
|
|
60063
|
+
}
|
|
60064
|
+
const withoutMultiplicity = path10.replace(/\s*\[[^\]]*\]\s*$/u, "").trim();
|
|
60065
|
+
return withoutMultiplicity ? canonicalEscapedName(withoutMultiplicity) : void 0;
|
|
60066
|
+
}
|
|
60034
60067
|
var FeaturePathResolver = class {
|
|
60035
60068
|
indexManager;
|
|
60036
60069
|
descriptions;
|
|
60037
60070
|
documents;
|
|
60038
60071
|
locator;
|
|
60039
60072
|
snapshots = /* @__PURE__ */ new WeakMap();
|
|
60073
|
+
resolvingSpecializations = /* @__PURE__ */ new Set();
|
|
60040
60074
|
constructor(services) {
|
|
60041
60075
|
this.indexManager = services?.shared.workspace.IndexManager;
|
|
60042
60076
|
this.descriptions = services?.workspace.AstNodeDescriptionProvider;
|
|
@@ -60139,6 +60173,14 @@ var FeaturePathResolver = class {
|
|
|
60139
60173
|
}
|
|
60140
60174
|
return result;
|
|
60141
60175
|
}
|
|
60176
|
+
/** Semantic owners reached through typing and specialization. This is used
|
|
60177
|
+
* when an anonymous redefinition has no keyword from which to recover its
|
|
60178
|
+
* feature kind. */
|
|
60179
|
+
// REQ-364: recover the semantic kind of an anonymous local redefinition.
|
|
60180
|
+
inheritedOwners(node) {
|
|
60181
|
+
const root3 = ast_utils_exports.getDocument(node).parseResult.value;
|
|
60182
|
+
return this.typedAndSpecializedOwners(node, this.snapshot(root3));
|
|
60183
|
+
}
|
|
60142
60184
|
segmentsOf(node) {
|
|
60143
60185
|
const cst = node.$cstNode;
|
|
60144
60186
|
if (!cst)
|
|
@@ -60284,20 +60326,45 @@ var FeaturePathResolver = class {
|
|
|
60284
60326
|
return typed;
|
|
60285
60327
|
}
|
|
60286
60328
|
specializationTargets(node, snapshot) {
|
|
60329
|
+
if (this.resolvingSpecializations.has(node))
|
|
60330
|
+
return [];
|
|
60331
|
+
this.resolvingSpecializations.add(node);
|
|
60287
60332
|
const relNode = node;
|
|
60288
60333
|
const result = [];
|
|
60289
|
-
|
|
60290
|
-
|
|
60291
|
-
|
|
60292
|
-
|
|
60293
|
-
const
|
|
60294
|
-
|
|
60295
|
-
|
|
60296
|
-
|
|
60334
|
+
try {
|
|
60335
|
+
for (const relation of [...relNode.preRelationships ?? [], ...relNode.relationships ?? []]) {
|
|
60336
|
+
if (!relation.kind || !SPECIALIZATION_KINDS2.has(relation.kind))
|
|
60337
|
+
continue;
|
|
60338
|
+
for (const target of relation.targets ?? []) {
|
|
60339
|
+
const simple = simpleRelationName(target);
|
|
60340
|
+
const scoped = simple ? this.scopedSpecializationTarget(node, simple, snapshot) : void 0;
|
|
60341
|
+
const description = scoped ? void 0 : this.pickDescription(snapshot.byName.get(target), node) ?? this.pickDescription(snapshot.byName.get(lastSegment2(target)), node);
|
|
60342
|
+
const resolved = scoped ?? this.nodeOf(description);
|
|
60343
|
+
if (resolved)
|
|
60344
|
+
result.push(resolved);
|
|
60345
|
+
}
|
|
60297
60346
|
}
|
|
60347
|
+
} finally {
|
|
60348
|
+
this.resolvingSpecializations.delete(node);
|
|
60298
60349
|
}
|
|
60299
60350
|
return result;
|
|
60300
60351
|
}
|
|
60352
|
+
/** A simple feature specialization is resolved in the visible inventory of
|
|
60353
|
+
* its lexical owner. Only an absent scoped match may fall back to the global
|
|
60354
|
+
* index, which prevents an unrelated same-named feature from winning. */
|
|
60355
|
+
scopedSpecializationTarget(node, name, snapshot) {
|
|
60356
|
+
for (let scope = node.$container; scope; scope = scope.$container) {
|
|
60357
|
+
const local = directNamedChildren(scope).find((candidate) => candidate !== node && nameOf(candidate) === name);
|
|
60358
|
+
if (local)
|
|
60359
|
+
return local;
|
|
60360
|
+
for (const owner of this.typedAndSpecializedOwners(scope, snapshot)) {
|
|
60361
|
+
const inherited = directNamedChildren(owner).find((candidate) => candidate !== node && nameOf(candidate) === name);
|
|
60362
|
+
if (inherited)
|
|
60363
|
+
return inherited;
|
|
60364
|
+
}
|
|
60365
|
+
}
|
|
60366
|
+
return void 0;
|
|
60367
|
+
}
|
|
60301
60368
|
memberInventoryKnown(node, snapshot) {
|
|
60302
60369
|
const record = node;
|
|
60303
60370
|
if (record.isDef === true || node.$type === "ClassDecl" || node.$type === "StructDecl" || node.$type === "EnumDecl" || node.$type === "DatatypeDecl" || node.$type === "FunctionDecl" || node.$type === "PredicateDecl") {
|
|
@@ -68396,6 +68463,20 @@ var SysmlLinker = class extends DefaultLinker {
|
|
|
68396
68463
|
resolveIndexedNode(nodeDescription) {
|
|
68397
68464
|
return this.loadAstNode(nodeDescription);
|
|
68398
68465
|
}
|
|
68466
|
+
// REQ-210 — Annotation graphics
|
|
68467
|
+
/**
|
|
68468
|
+
* Return the parsed root for a live workspace or lazily loaded library file.
|
|
68469
|
+
* Diagram projection uses this to collect annotations declared beside an
|
|
68470
|
+
* inherited member without adding standard-library files to the workspace.
|
|
68471
|
+
*/
|
|
68472
|
+
resolveDocumentRoot(uri) {
|
|
68473
|
+
const live = this.langiumDocuments().getDocument(uri)?.parseResult?.value;
|
|
68474
|
+
if (live)
|
|
68475
|
+
return live;
|
|
68476
|
+
if (!isStandardLibraryUri(uri))
|
|
68477
|
+
return void 0;
|
|
68478
|
+
return this.parsedLibraryDocument(uri)?.parseResult?.value;
|
|
68479
|
+
}
|
|
68399
68480
|
/** Parse (once) the standard-library file a precomputed description points at.
|
|
68400
68481
|
* Prefers an already-live workspace document when one exists (runtime-loaded
|
|
68401
68482
|
* library, or the user opened the file) so there is never a second copy. */
|
|
@@ -72238,7 +72319,7 @@ async function runValidation(command) {
|
|
|
72238
72319
|
}
|
|
72239
72320
|
|
|
72240
72321
|
// src/main.ts
|
|
72241
|
-
var VERSION2 = true ? "0.
|
|
72322
|
+
var VERSION2 = true ? "0.21.1" : "dev";
|
|
72242
72323
|
async function main(argv) {
|
|
72243
72324
|
const command = parseArgs(argv);
|
|
72244
72325
|
if (command.kind === "help") {
|