sysml-diagram 0.42.0 → 0.43.0
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 +1592 -749
- package/out/main.js.map +4 -4
- package/package.json +1 -1
- package/resources/sysml.dimension-table.json +1 -1
package/out/main.js
CHANGED
|
@@ -163505,6 +163505,792 @@ function variantKindCompatibility(node, resolve8) {
|
|
|
163505
163505
|
return specializesKind(variantKind, ownerKind) ? "compatible" : "incompatible";
|
|
163506
163506
|
}
|
|
163507
163507
|
|
|
163508
|
+
// ../language-server/out/src/services/metadata-semantics.js
|
|
163509
|
+
var MAX_DEPTH = 32;
|
|
163510
|
+
var SPECIALIZATION_KINDS2 = /* @__PURE__ */ new Set([
|
|
163511
|
+
":>",
|
|
163512
|
+
"specializes",
|
|
163513
|
+
":>>",
|
|
163514
|
+
"redefines",
|
|
163515
|
+
"subsets"
|
|
163516
|
+
]);
|
|
163517
|
+
var REDEFINITION_KINDS2 = /* @__PURE__ */ new Set([":>>", "redefines"]);
|
|
163518
|
+
var STRUCTURAL_FEATURE_NAMES = /* @__PURE__ */ new Set(["self", "annotatedElement"]);
|
|
163519
|
+
var ANNOTATED_ELEMENT = "annotatedElement";
|
|
163520
|
+
var METAOBJECT_ROOT = "Metaobject";
|
|
163521
|
+
function isMetadataUsage(node) {
|
|
163522
|
+
if (node.$type === "MetadataAnnotation")
|
|
163523
|
+
return true;
|
|
163524
|
+
return node.$type === "MetadataDecl" && node.isDef !== true;
|
|
163525
|
+
}
|
|
163526
|
+
function isMetadataPrefixTag(node) {
|
|
163527
|
+
return node.$type === "PrefixMetadataTag";
|
|
163528
|
+
}
|
|
163529
|
+
function metadataTypeNamesOf(node) {
|
|
163530
|
+
const usage = node;
|
|
163531
|
+
const names = [];
|
|
163532
|
+
const add = (text) => {
|
|
163533
|
+
const trimmed = text?.trim();
|
|
163534
|
+
if (trimmed)
|
|
163535
|
+
names.push(trimmed);
|
|
163536
|
+
};
|
|
163537
|
+
add((usage.type ?? usage.typing?.type)?.$refText);
|
|
163538
|
+
for (const more of usage.typing?.moreTypes ?? [])
|
|
163539
|
+
add(more.$refText);
|
|
163540
|
+
for (const typing of usage.moreTypings ?? []) {
|
|
163541
|
+
add(typing.type?.$refText);
|
|
163542
|
+
for (const more of typing.moreTypes ?? [])
|
|
163543
|
+
add(more.$refText);
|
|
163544
|
+
}
|
|
163545
|
+
return names;
|
|
163546
|
+
}
|
|
163547
|
+
function metadataTypeNodeOf(node, resolve8) {
|
|
163548
|
+
const usage = node;
|
|
163549
|
+
const reference = usage.type ?? usage.typing?.type;
|
|
163550
|
+
if (reference?.ref)
|
|
163551
|
+
return reference.ref;
|
|
163552
|
+
const written = reference?.$refText?.trim();
|
|
163553
|
+
return written ? resolve8(written, node) : void 0;
|
|
163554
|
+
}
|
|
163555
|
+
function metadataBindingsOf(node) {
|
|
163556
|
+
const bindings = [];
|
|
163557
|
+
for (const member of node.members ?? []) {
|
|
163558
|
+
if (NON_BINDING_MEMBER_TYPES.has(member.$type))
|
|
163559
|
+
continue;
|
|
163560
|
+
const redefined = redefinedNameOf(member);
|
|
163561
|
+
if (redefined) {
|
|
163562
|
+
bindings.push({ name: redefined, form: "redefinition", node: member, value: member.value });
|
|
163563
|
+
continue;
|
|
163564
|
+
}
|
|
163565
|
+
if (member.name) {
|
|
163566
|
+
bindings.push({ name: member.name, form: "shorthand", node: member, value: member.value });
|
|
163567
|
+
}
|
|
163568
|
+
}
|
|
163569
|
+
return bindings;
|
|
163570
|
+
}
|
|
163571
|
+
var NON_BINDING_MEMBER_TYPES = /* @__PURE__ */ new Set([
|
|
163572
|
+
"DocCommentMember",
|
|
163573
|
+
"CommentStmt",
|
|
163574
|
+
"RepStmt",
|
|
163575
|
+
"MetadataAnnotation",
|
|
163576
|
+
"PrefixMetadataMember",
|
|
163577
|
+
"Import",
|
|
163578
|
+
"AliasDecl",
|
|
163579
|
+
"FilterMember"
|
|
163580
|
+
]);
|
|
163581
|
+
function redefinedNameOf(member) {
|
|
163582
|
+
for (const relationship of [...member.preRelationships ?? [], ...member.relationships ?? []]) {
|
|
163583
|
+
if (!relationship.kind || !REDEFINITION_KINDS2.has(relationship.kind))
|
|
163584
|
+
continue;
|
|
163585
|
+
const target = (relationship.targets ?? [])[0];
|
|
163586
|
+
const simple = target?.split(/::|\./u).pop()?.trim();
|
|
163587
|
+
if (simple)
|
|
163588
|
+
return simple;
|
|
163589
|
+
}
|
|
163590
|
+
return void 0;
|
|
163591
|
+
}
|
|
163592
|
+
function metadataFeaturesOf(type, resolve8, implicitBaseNames = () => []) {
|
|
163593
|
+
const features = /* @__PURE__ */ new Map();
|
|
163594
|
+
const inherited = new Set(STRUCTURAL_FEATURE_NAMES);
|
|
163595
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163596
|
+
let complete = true;
|
|
163597
|
+
const collectNames = (owner, depth, visited) => {
|
|
163598
|
+
if (!owner || depth > MAX_DEPTH || visited.has(owner))
|
|
163599
|
+
return;
|
|
163600
|
+
visited.add(owner);
|
|
163601
|
+
for (const member of owner.members ?? []) {
|
|
163602
|
+
const name = member.name ?? redefinedNameOf(member);
|
|
163603
|
+
if (name)
|
|
163604
|
+
inherited.add(name);
|
|
163605
|
+
}
|
|
163606
|
+
for (const supertype of specializationTargetsOf(owner)) {
|
|
163607
|
+
collectNames(resolve8(supertype, owner), depth + 1, visited);
|
|
163608
|
+
}
|
|
163609
|
+
};
|
|
163610
|
+
const walk = (owner, depth) => {
|
|
163611
|
+
if (!owner || depth > MAX_DEPTH || seen.has(owner)) {
|
|
163612
|
+
if (!owner)
|
|
163613
|
+
complete = false;
|
|
163614
|
+
return;
|
|
163615
|
+
}
|
|
163616
|
+
seen.add(owner);
|
|
163617
|
+
for (const base of implicitBaseNames(owner)) {
|
|
163618
|
+
collectNames(resolve8(base, owner), 0, /* @__PURE__ */ new Set());
|
|
163619
|
+
}
|
|
163620
|
+
for (const member of owner.members ?? []) {
|
|
163621
|
+
if (!isFeatureMember(member))
|
|
163622
|
+
continue;
|
|
163623
|
+
const name = member.name ?? redefinedNameOf(member);
|
|
163624
|
+
if (!name)
|
|
163625
|
+
continue;
|
|
163626
|
+
const known2 = features.get(name);
|
|
163627
|
+
if (known2) {
|
|
163628
|
+
if (suppliedValueOf(member) !== void 0) {
|
|
163629
|
+
known2.hasDefault = true;
|
|
163630
|
+
known2.required = false;
|
|
163631
|
+
}
|
|
163632
|
+
continue;
|
|
163633
|
+
}
|
|
163634
|
+
features.set(name, {
|
|
163635
|
+
name,
|
|
163636
|
+
node: member,
|
|
163637
|
+
typeName: writtenTypeNameOf(member),
|
|
163638
|
+
hasDefault: suppliedValueOf(member) !== void 0,
|
|
163639
|
+
required: isRequiredFeature(member)
|
|
163640
|
+
});
|
|
163641
|
+
}
|
|
163642
|
+
for (const supertype of specializationTargetsOf(owner)) {
|
|
163643
|
+
const resolved = resolve8(supertype, owner);
|
|
163644
|
+
if (!resolved) {
|
|
163645
|
+
complete = false;
|
|
163646
|
+
continue;
|
|
163647
|
+
}
|
|
163648
|
+
if (isMetaobjectRoot(supertype, resolved)) {
|
|
163649
|
+
collectNames(resolved, 0, /* @__PURE__ */ new Set());
|
|
163650
|
+
continue;
|
|
163651
|
+
}
|
|
163652
|
+
walk(resolved, depth + 1);
|
|
163653
|
+
}
|
|
163654
|
+
};
|
|
163655
|
+
if (!type)
|
|
163656
|
+
return { features: [], inherited, complete: false };
|
|
163657
|
+
walk(type, 0);
|
|
163658
|
+
return { features: [...features.values()], inherited, complete };
|
|
163659
|
+
}
|
|
163660
|
+
function isMetaobjectRoot(written, resolved) {
|
|
163661
|
+
return written.split(/::|\./u).pop()?.trim() === METAOBJECT_ROOT || resolved.name === METAOBJECT_ROOT;
|
|
163662
|
+
}
|
|
163663
|
+
function isFeatureMember(member) {
|
|
163664
|
+
if (NON_BINDING_MEMBER_TYPES.has(member.$type))
|
|
163665
|
+
return false;
|
|
163666
|
+
if (member.$type === "MetadataDecl" && member.isDef === true)
|
|
163667
|
+
return false;
|
|
163668
|
+
return member.name !== void 0 || redefinedNameOf(member) !== void 0;
|
|
163669
|
+
}
|
|
163670
|
+
function writtenTypeNameOf(member) {
|
|
163671
|
+
const written = member.typing?.type?.$refText?.trim();
|
|
163672
|
+
return written && written.length > 0 ? written : void 0;
|
|
163673
|
+
}
|
|
163674
|
+
function suppliedValueOf(member) {
|
|
163675
|
+
return member.value ?? member.default?.value;
|
|
163676
|
+
}
|
|
163677
|
+
function isRequiredFeature(member) {
|
|
163678
|
+
if (suppliedValueOf(member) !== void 0)
|
|
163679
|
+
return false;
|
|
163680
|
+
if ((member.modifiers ?? []).includes("abstract"))
|
|
163681
|
+
return false;
|
|
163682
|
+
if (STRUCTURAL_FEATURE_NAMES.has(member.name ?? ""))
|
|
163683
|
+
return false;
|
|
163684
|
+
if (STRUCTURAL_FEATURE_NAMES.has(redefinedNameOf(member) ?? ""))
|
|
163685
|
+
return false;
|
|
163686
|
+
const lower2 = member.multiplicity?.lower;
|
|
163687
|
+
if (!lower2)
|
|
163688
|
+
return true;
|
|
163689
|
+
if (lower2.star === true)
|
|
163690
|
+
return false;
|
|
163691
|
+
if (lower2.intVal === void 0)
|
|
163692
|
+
return false;
|
|
163693
|
+
return lower2.intVal >= 1;
|
|
163694
|
+
}
|
|
163695
|
+
function annotatedElementRestrictionsOf(type, resolve8) {
|
|
163696
|
+
const restrictions = [];
|
|
163697
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163698
|
+
const walk = (owner, depth) => {
|
|
163699
|
+
if (!owner || depth > MAX_DEPTH || seen.has(owner))
|
|
163700
|
+
return;
|
|
163701
|
+
seen.add(owner);
|
|
163702
|
+
for (const member of owner.members ?? []) {
|
|
163703
|
+
const binds = member.name === ANNOTATED_ELEMENT || redefinedNameOf(member) === ANNOTATED_ELEMENT || subsetTargetsOf(member).includes(ANNOTATED_ELEMENT);
|
|
163704
|
+
if (!binds)
|
|
163705
|
+
continue;
|
|
163706
|
+
const typeName = writtenTypeNameOf(member);
|
|
163707
|
+
if (typeName) {
|
|
163708
|
+
restrictions.push({ typeName, node: member, owner, resolvedType: resolve8(typeName, member) });
|
|
163709
|
+
}
|
|
163710
|
+
}
|
|
163711
|
+
for (const supertype of specializationTargetsOf(owner))
|
|
163712
|
+
walk(resolve8(supertype, owner), depth + 1);
|
|
163713
|
+
};
|
|
163714
|
+
walk(type, 0);
|
|
163715
|
+
return restrictions;
|
|
163716
|
+
}
|
|
163717
|
+
function subsetTargetsOf(member) {
|
|
163718
|
+
const targets = [];
|
|
163719
|
+
for (const relationship of [...member.preRelationships ?? [], ...member.relationships ?? []]) {
|
|
163720
|
+
if (relationship.kind !== ":>" && relationship.kind !== "subsets")
|
|
163721
|
+
continue;
|
|
163722
|
+
for (const target of relationship.targets ?? []) {
|
|
163723
|
+
const simple = target.split(/::|\./u).pop()?.trim();
|
|
163724
|
+
if (simple)
|
|
163725
|
+
targets.push(simple);
|
|
163726
|
+
}
|
|
163727
|
+
}
|
|
163728
|
+
return targets;
|
|
163729
|
+
}
|
|
163730
|
+
function metadataTargetsOf(node, resolve8) {
|
|
163731
|
+
const usage = node;
|
|
163732
|
+
const written = usage.targets ?? [];
|
|
163733
|
+
if (written.length > 0) {
|
|
163734
|
+
return written.map((text, occurrence) => ({
|
|
163735
|
+
text: text.trim(),
|
|
163736
|
+
node: resolve8(text.trim(), occurrence),
|
|
163737
|
+
explicit: true
|
|
163738
|
+
}));
|
|
163739
|
+
}
|
|
163740
|
+
const owner = annotatedOwnerOf(node);
|
|
163741
|
+
if (!owner)
|
|
163742
|
+
return [];
|
|
163743
|
+
return [{ text: owner.name ?? owner.$type, node: owner, explicit: false }];
|
|
163744
|
+
}
|
|
163745
|
+
function annotatedOwnerOf(node) {
|
|
163746
|
+
const container = node.$container;
|
|
163747
|
+
if (container?.$type === "PrefixMetadataMember") {
|
|
163748
|
+
return container.element;
|
|
163749
|
+
}
|
|
163750
|
+
if (!container)
|
|
163751
|
+
return void 0;
|
|
163752
|
+
if (!NON_ANNOTATED_CONTAINERS.has(container.$type))
|
|
163753
|
+
return container;
|
|
163754
|
+
if (node.$type !== "MetadataAnnotation")
|
|
163755
|
+
return void 0;
|
|
163756
|
+
return followingDeclarationOf(node, container);
|
|
163757
|
+
}
|
|
163758
|
+
function followingDeclarationOf(node, container) {
|
|
163759
|
+
const members = container.members ?? container.elements ?? [];
|
|
163760
|
+
const index2 = members.indexOf(node);
|
|
163761
|
+
if (index2 < 0)
|
|
163762
|
+
return void 0;
|
|
163763
|
+
for (let next = index2 + 1; next < members.length; next += 1) {
|
|
163764
|
+
const candidate = members[next];
|
|
163765
|
+
if (candidate.$type === "MetadataAnnotation")
|
|
163766
|
+
continue;
|
|
163767
|
+
return candidate;
|
|
163768
|
+
}
|
|
163769
|
+
return void 0;
|
|
163770
|
+
}
|
|
163771
|
+
var NON_ANNOTATED_CONTAINERS = /* @__PURE__ */ new Set(["Document", "Package", "NamespaceDecl"]);
|
|
163772
|
+
function valueEvaluability(value, resolve8) {
|
|
163773
|
+
if (!value)
|
|
163774
|
+
return "unknown";
|
|
163775
|
+
let verdict = "model-level";
|
|
163776
|
+
for (const node of [value, ...ast_utils_exports.streamAllContents(value)]) {
|
|
163777
|
+
if (node.$type !== "PathExpr")
|
|
163778
|
+
continue;
|
|
163779
|
+
const written = pathTextOf(node);
|
|
163780
|
+
if (!written)
|
|
163781
|
+
return "unknown";
|
|
163782
|
+
const segments = written.split(/::|\./u).map((segment) => segment.trim()).filter(Boolean);
|
|
163783
|
+
const root4 = segments.length > 0 ? resolve8(segments[0], node) : void 0;
|
|
163784
|
+
if (root4 && isOccurrenceUsage(root4))
|
|
163785
|
+
return "instance-level";
|
|
163786
|
+
if (segments.length > 1) {
|
|
163787
|
+
if (!root4)
|
|
163788
|
+
return "unknown";
|
|
163789
|
+
continue;
|
|
163790
|
+
}
|
|
163791
|
+
const target = resolve8(written, node);
|
|
163792
|
+
if (!target)
|
|
163793
|
+
return "unknown";
|
|
163794
|
+
if (referentEvaluability(target) === "unknown")
|
|
163795
|
+
verdict = "unknown";
|
|
163796
|
+
}
|
|
163797
|
+
return verdict;
|
|
163798
|
+
}
|
|
163799
|
+
function pathTextOf(node) {
|
|
163800
|
+
const text = node.$cstNode?.text?.trim();
|
|
163801
|
+
return text && text.length > 0 ? text : void 0;
|
|
163802
|
+
}
|
|
163803
|
+
function referentEvaluability(target) {
|
|
163804
|
+
if (isOwnedEnumerationValue(target))
|
|
163805
|
+
return "model-level";
|
|
163806
|
+
const node = target;
|
|
163807
|
+
if (node.isDef === true)
|
|
163808
|
+
return "model-level";
|
|
163809
|
+
if (node.value !== void 0)
|
|
163810
|
+
return "model-level";
|
|
163811
|
+
return isOccurrenceUsage(node) ? "instance-level" : "unknown";
|
|
163812
|
+
}
|
|
163813
|
+
function isOccurrenceUsage(node) {
|
|
163814
|
+
return node.isDef !== true && OCCURRENCE_USAGE_TYPES.has(node.$type);
|
|
163815
|
+
}
|
|
163816
|
+
var OCCURRENCE_USAGE_TYPES = /* @__PURE__ */ new Set([
|
|
163817
|
+
"PartDecl",
|
|
163818
|
+
"ItemDecl",
|
|
163819
|
+
"PortDecl",
|
|
163820
|
+
"ActionDecl",
|
|
163821
|
+
"StateDecl",
|
|
163822
|
+
"OccurrenceDecl",
|
|
163823
|
+
"ConnectionDecl",
|
|
163824
|
+
"InterfaceDecl",
|
|
163825
|
+
"AllocationDecl",
|
|
163826
|
+
"EventDecl"
|
|
163827
|
+
]);
|
|
163828
|
+
function specializationTargetsOf(node) {
|
|
163829
|
+
const owner = node;
|
|
163830
|
+
const targets = [];
|
|
163831
|
+
for (const relationship of [...owner.preRelationships ?? [], ...owner.relationships ?? []]) {
|
|
163832
|
+
if (relationship.kind && SPECIALIZATION_KINDS2.has(relationship.kind)) {
|
|
163833
|
+
targets.push(...relationship.targets ?? []);
|
|
163834
|
+
}
|
|
163835
|
+
}
|
|
163836
|
+
const typed = owner.typing?.type?.$refText;
|
|
163837
|
+
if (typed)
|
|
163838
|
+
targets.push(typed);
|
|
163839
|
+
return targets.map((target) => target.trim()).filter((target) => target.length > 0);
|
|
163840
|
+
}
|
|
163841
|
+
|
|
163842
|
+
// ../language-server/out/src/services/semantic-metadata.js
|
|
163843
|
+
var SEMANTIC_METADATA = "SemanticMetadata";
|
|
163844
|
+
var BASE_TYPE = "baseType";
|
|
163845
|
+
var MAX_DEPTH2 = 32;
|
|
163846
|
+
var SPECIALIZATION_KINDS3 = /* @__PURE__ */ new Set([
|
|
163847
|
+
":>",
|
|
163848
|
+
"specializes",
|
|
163849
|
+
":>>",
|
|
163850
|
+
"redefines",
|
|
163851
|
+
"subsets"
|
|
163852
|
+
]);
|
|
163853
|
+
var NON_TYPE_NODE_TYPES = /* @__PURE__ */ new Set([
|
|
163854
|
+
"Document",
|
|
163855
|
+
"Package",
|
|
163856
|
+
"NamespaceDecl",
|
|
163857
|
+
"Import",
|
|
163858
|
+
"ImportSeg",
|
|
163859
|
+
"AliasDecl",
|
|
163860
|
+
"DocCommentMember",
|
|
163861
|
+
"CommentStmt",
|
|
163862
|
+
"RepStmt",
|
|
163863
|
+
"FilterMember",
|
|
163864
|
+
"MultiplicityDecl",
|
|
163865
|
+
// A dependency is a Relationship between elements, not a Type, so it can
|
|
163866
|
+
// neither be a base type nor carry a semantic tag (Codex review of PR 294).
|
|
163867
|
+
"DependencyDecl"
|
|
163868
|
+
]);
|
|
163869
|
+
var KERML_CLASSIFIER_TYPES = /* @__PURE__ */ new Set([
|
|
163870
|
+
"TypeDecl",
|
|
163871
|
+
"ClassDecl",
|
|
163872
|
+
"ClassifierDecl",
|
|
163873
|
+
"StructDecl",
|
|
163874
|
+
"DatatypeDecl",
|
|
163875
|
+
"MetaclassDecl",
|
|
163876
|
+
"AssociationDecl",
|
|
163877
|
+
"BehaviorDecl",
|
|
163878
|
+
"InteractionDecl",
|
|
163879
|
+
"FunctionDecl",
|
|
163880
|
+
"PredicateDecl"
|
|
163881
|
+
]);
|
|
163882
|
+
function semanticFormOf(node) {
|
|
163883
|
+
if (!node)
|
|
163884
|
+
return "not-a-type";
|
|
163885
|
+
if (NON_TYPE_NODE_TYPES.has(node.$type))
|
|
163886
|
+
return "not-a-type";
|
|
163887
|
+
if (node.$type === "BareDefDecl")
|
|
163888
|
+
return "definition";
|
|
163889
|
+
if (node.isDef === true)
|
|
163890
|
+
return "definition";
|
|
163891
|
+
return KERML_CLASSIFIER_TYPES.has(node.$type) ? "definition" : "usage";
|
|
163892
|
+
}
|
|
163893
|
+
function semanticEdgeFor(annotated, base) {
|
|
163894
|
+
if (annotated === "definition" && base === "definition") {
|
|
163895
|
+
return { metaclass: "Specialization", written: ":>", phrase: "specializes" };
|
|
163896
|
+
}
|
|
163897
|
+
if (annotated === "usage" && base === "definition") {
|
|
163898
|
+
return { metaclass: "FeatureTyping", written: ":", phrase: "defined by" };
|
|
163899
|
+
}
|
|
163900
|
+
if (annotated === "usage" && base === "usage") {
|
|
163901
|
+
return { metaclass: "Subsetting", written: ":>", phrase: "subsets" };
|
|
163902
|
+
}
|
|
163903
|
+
return void 0;
|
|
163904
|
+
}
|
|
163905
|
+
function semanticMetadataVerdictOf(type, resolve8) {
|
|
163906
|
+
if (!type)
|
|
163907
|
+
return { isSemantic: false, complete: false };
|
|
163908
|
+
let complete = true;
|
|
163909
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163910
|
+
const walk = (owner, depth) => {
|
|
163911
|
+
if (!owner || depth > MAX_DEPTH2 || seen.has(owner))
|
|
163912
|
+
return false;
|
|
163913
|
+
seen.add(owner);
|
|
163914
|
+
for (const target of specializationTargetsOf2(owner)) {
|
|
163915
|
+
if (simpleNameOf(target) === SEMANTIC_METADATA)
|
|
163916
|
+
return true;
|
|
163917
|
+
const resolved = resolve8(target, owner);
|
|
163918
|
+
if (!resolved) {
|
|
163919
|
+
complete = false;
|
|
163920
|
+
continue;
|
|
163921
|
+
}
|
|
163922
|
+
if (nameOf(resolved) === SEMANTIC_METADATA)
|
|
163923
|
+
return true;
|
|
163924
|
+
if (walk(resolved, depth + 1))
|
|
163925
|
+
return true;
|
|
163926
|
+
}
|
|
163927
|
+
return false;
|
|
163928
|
+
};
|
|
163929
|
+
const isSemantic = nameOf(type) === SEMANTIC_METADATA || walk(type, 0);
|
|
163930
|
+
return { isSemantic, complete };
|
|
163931
|
+
}
|
|
163932
|
+
function baseTypeBindingsOf(type, resolve8) {
|
|
163933
|
+
const bindings = [];
|
|
163934
|
+
const seen = /* @__PURE__ */ new Set();
|
|
163935
|
+
let complete = true;
|
|
163936
|
+
const walk = (owner, depth) => {
|
|
163937
|
+
if (!owner || depth > MAX_DEPTH2 || seen.has(owner))
|
|
163938
|
+
return;
|
|
163939
|
+
seen.add(owner);
|
|
163940
|
+
for (const member of owner.members ?? []) {
|
|
163941
|
+
if (boundFeatureNameOf(member) !== BASE_TYPE)
|
|
163942
|
+
continue;
|
|
163943
|
+
const value = member.value ?? member.default?.value;
|
|
163944
|
+
const read = baseTypeValueOf(value);
|
|
163945
|
+
if (read)
|
|
163946
|
+
bindings.push({ ...read, node: member, owner });
|
|
163947
|
+
}
|
|
163948
|
+
for (const target of specializationTargetsOf2(owner)) {
|
|
163949
|
+
const resolved = resolve8(target, owner);
|
|
163950
|
+
if (!resolved) {
|
|
163951
|
+
complete = false;
|
|
163952
|
+
continue;
|
|
163953
|
+
}
|
|
163954
|
+
walk(resolved, depth + 1);
|
|
163955
|
+
}
|
|
163956
|
+
};
|
|
163957
|
+
if (!type)
|
|
163958
|
+
return { bindings: [], complete: false };
|
|
163959
|
+
walk(type, 0);
|
|
163960
|
+
return { bindings, complete };
|
|
163961
|
+
}
|
|
163962
|
+
function baseTypeValueOf(value) {
|
|
163963
|
+
if (!value)
|
|
163964
|
+
return void 0;
|
|
163965
|
+
const node = value;
|
|
163966
|
+
if (node.$type === "ClassifyOp" && (node.op === "meta" || node.op === "as")) {
|
|
163967
|
+
const written = pathTextOf2(node.left);
|
|
163968
|
+
if (!written)
|
|
163969
|
+
return void 0;
|
|
163970
|
+
return { written, castTypeName: node.type?.$refText?.trim() || void 0 };
|
|
163971
|
+
}
|
|
163972
|
+
if (node.$type === "PathExpr") {
|
|
163973
|
+
const written = pathTextOf2(node);
|
|
163974
|
+
return written ? { written } : void 0;
|
|
163975
|
+
}
|
|
163976
|
+
return void 0;
|
|
163977
|
+
}
|
|
163978
|
+
function resolveSemanticBase(binding, resolve8) {
|
|
163979
|
+
const node = resolve8(binding.written, binding.node) ?? resolve8(binding.written, binding.owner);
|
|
163980
|
+
if (node)
|
|
163981
|
+
return { binding, node, form: semanticFormOf(node), unresolved: false };
|
|
163982
|
+
const cast = binding.castTypeName ? metaclassFormOf(binding.castTypeName) : void 0;
|
|
163983
|
+
return { binding, form: cast ?? "not-a-type", unresolved: true };
|
|
163984
|
+
}
|
|
163985
|
+
function metaclassFormOf(name) {
|
|
163986
|
+
const simple = simpleNameOf(name);
|
|
163987
|
+
if (simple.endsWith("Usage"))
|
|
163988
|
+
return "usage";
|
|
163989
|
+
if (simple.endsWith("Definition"))
|
|
163990
|
+
return "definition";
|
|
163991
|
+
return void 0;
|
|
163992
|
+
}
|
|
163993
|
+
var SemanticMetadataModel = class {
|
|
163994
|
+
resolve;
|
|
163995
|
+
resolveTarget;
|
|
163996
|
+
byElement = /* @__PURE__ */ new Map();
|
|
163997
|
+
typeVerdicts = /* @__PURE__ */ new Map();
|
|
163998
|
+
typeBases = /* @__PURE__ */ new Map();
|
|
163999
|
+
/**
|
|
164000
|
+
* `resolveTarget` resolves one written `about` path. It takes the usage the
|
|
164001
|
+
* path is written on, because a path is read in the scope it sits in: the
|
|
164002
|
+
* bare {@link MetadataTargetResolver} signature carries only the text and its
|
|
164003
|
+
* position, which is enough for one usage at a time but not for a model that
|
|
164004
|
+
* reads a whole document.
|
|
164005
|
+
*/
|
|
164006
|
+
constructor(resolve8, resolveTarget = () => void 0) {
|
|
164007
|
+
this.resolve = resolve8;
|
|
164008
|
+
this.resolveTarget = resolveTarget;
|
|
164009
|
+
}
|
|
164010
|
+
/** Read every metadata usage in one parsed document. */
|
|
164011
|
+
build(root4) {
|
|
164012
|
+
for (const node of [root4, ...ast_utils_exports.streamAllContents(root4)]) {
|
|
164013
|
+
if (!isMetadataUsage(node) && !isMetadataPrefixTag(node))
|
|
164014
|
+
continue;
|
|
164015
|
+
for (const annotation of this.readUsage(node)) {
|
|
164016
|
+
const known2 = this.byElement.get(annotation.annotated);
|
|
164017
|
+
if (known2)
|
|
164018
|
+
known2.push(annotation);
|
|
164019
|
+
else
|
|
164020
|
+
this.byElement.set(annotation.annotated, [annotation]);
|
|
164021
|
+
}
|
|
164022
|
+
}
|
|
164023
|
+
return this;
|
|
164024
|
+
}
|
|
164025
|
+
/** The semantic annotations on one element, in document order. */
|
|
164026
|
+
annotationsOf(node) {
|
|
164027
|
+
return this.byElement.get(node) ?? [];
|
|
164028
|
+
}
|
|
164029
|
+
/**
|
|
164030
|
+
* The edges one element gains, deduplicated by the base each one reaches.
|
|
164031
|
+
*
|
|
164032
|
+
* Two tags naming one base state one edge, so the second is dropped rather
|
|
164033
|
+
* than drawn twice. Two tags naming DIFFERENT bases both stand: subsetting
|
|
164034
|
+
* two features is ordinary SysML, and it is the `baseType` hierarchy, not
|
|
164035
|
+
* the tag count, that `SSM059` judges.
|
|
164036
|
+
*/
|
|
164037
|
+
edgesOf(node) {
|
|
164038
|
+
const out = [];
|
|
164039
|
+
const seen = /* @__PURE__ */ new Set();
|
|
164040
|
+
for (const annotation of this.annotationsOf(node)) {
|
|
164041
|
+
if (!annotation.edge || !annotation.base)
|
|
164042
|
+
continue;
|
|
164043
|
+
const key2 = annotation.base.node ? this.keyOf(annotation.base.node) : `written:${annotation.base.binding.written}`;
|
|
164044
|
+
if (seen.has(key2))
|
|
164045
|
+
continue;
|
|
164046
|
+
seen.add(key2);
|
|
164047
|
+
out.push(annotation);
|
|
164048
|
+
}
|
|
164049
|
+
return out;
|
|
164050
|
+
}
|
|
164051
|
+
/** Every element this document tags, for a caller that walks the model. */
|
|
164052
|
+
annotatedElements() {
|
|
164053
|
+
return [...this.byElement.keys()];
|
|
164054
|
+
}
|
|
164055
|
+
/**
|
|
164056
|
+
* issue #169 - does the implied edge come back to the element it starts
|
|
164057
|
+
* from?
|
|
164058
|
+
*
|
|
164059
|
+
* A written `part def A :> A;` is rejected by the ordinary specialization
|
|
164060
|
+
* checks; the implied one has to be judged the same way, and it is easier to
|
|
164061
|
+
* write by accident: a keyword whose base type is itself tagged with that
|
|
164062
|
+
* keyword closes the loop without either declaration looking wrong on its
|
|
164063
|
+
* own. The walk follows BOTH kinds of edge for that reason - the written
|
|
164064
|
+
* supertypes and the implied ones - and is depth-capped, so a model that is
|
|
164065
|
+
* already cyclic cannot hang the pass that reports it.
|
|
164066
|
+
*/
|
|
164067
|
+
isCyclicBase(annotated, base) {
|
|
164068
|
+
if (!base.node)
|
|
164069
|
+
return false;
|
|
164070
|
+
if (base.node === annotated)
|
|
164071
|
+
return true;
|
|
164072
|
+
return this.reaches(base.node, annotated, 0, /* @__PURE__ */ new Set([annotated]));
|
|
164073
|
+
}
|
|
164074
|
+
reaches(from, goal, depth, seen) {
|
|
164075
|
+
if (depth > MAX_DEPTH2 || seen.has(from))
|
|
164076
|
+
return false;
|
|
164077
|
+
seen.add(from);
|
|
164078
|
+
for (const written of specializationTargetsOf2(from)) {
|
|
164079
|
+
const next = this.resolve(written, from);
|
|
164080
|
+
if (!next)
|
|
164081
|
+
continue;
|
|
164082
|
+
if (next === goal)
|
|
164083
|
+
return true;
|
|
164084
|
+
if (this.reaches(next, goal, depth + 1, seen))
|
|
164085
|
+
return true;
|
|
164086
|
+
}
|
|
164087
|
+
for (const annotation of this.annotationsOf(from)) {
|
|
164088
|
+
const next = annotation.edge && annotation.base?.node;
|
|
164089
|
+
if (!next)
|
|
164090
|
+
continue;
|
|
164091
|
+
if (next === goal)
|
|
164092
|
+
return true;
|
|
164093
|
+
if (this.reaches(next, goal, depth + 1, seen))
|
|
164094
|
+
return true;
|
|
164095
|
+
}
|
|
164096
|
+
return false;
|
|
164097
|
+
}
|
|
164098
|
+
/** Identity of a resolved base, which may live in another document. The CST
|
|
164099
|
+
* offset alone would collide across files, so the document is part of it. */
|
|
164100
|
+
keyOf(node) {
|
|
164101
|
+
const root4 = ast_utils_exports.findRootNode(node);
|
|
164102
|
+
const uri = root4.$document?.uri;
|
|
164103
|
+
return `${String(uri ?? "")}#${node.$cstNode?.offset ?? node.name ?? ""}`;
|
|
164104
|
+
}
|
|
164105
|
+
readUsage(usage) {
|
|
164106
|
+
const type = metadataTypeNodeOf(usage, this.resolve);
|
|
164107
|
+
const verdict = this.verdictOf(type);
|
|
164108
|
+
if (!verdict.isSemantic)
|
|
164109
|
+
return [];
|
|
164110
|
+
const reading = this.basesOf(type);
|
|
164111
|
+
const binding = reading.bindings[0];
|
|
164112
|
+
const base = binding ? resolveSemanticBase(binding, this.resolve) : void 0;
|
|
164113
|
+
const complete = verdict.complete && reading.complete;
|
|
164114
|
+
const forUsage = (text, occurrence) => this.resolveTarget(usage, text, occurrence);
|
|
164115
|
+
const targets = metadataTargetsOf(usage, forUsage);
|
|
164116
|
+
const out = [];
|
|
164117
|
+
for (const target of targets) {
|
|
164118
|
+
if (!target.node)
|
|
164119
|
+
continue;
|
|
164120
|
+
out.push({
|
|
164121
|
+
usage,
|
|
164122
|
+
type,
|
|
164123
|
+
annotated: target.node,
|
|
164124
|
+
base,
|
|
164125
|
+
complete,
|
|
164126
|
+
bindings: reading.bindings,
|
|
164127
|
+
edge: base ? semanticEdgeFor(semanticFormOf(target.node), base.form) : void 0
|
|
164128
|
+
});
|
|
164129
|
+
}
|
|
164130
|
+
return out;
|
|
164131
|
+
}
|
|
164132
|
+
verdictOf(type) {
|
|
164133
|
+
if (!type)
|
|
164134
|
+
return { isSemantic: false, complete: false };
|
|
164135
|
+
const cached = this.typeVerdicts.get(type);
|
|
164136
|
+
if (cached)
|
|
164137
|
+
return cached;
|
|
164138
|
+
const built = semanticMetadataVerdictOf(type, this.resolve);
|
|
164139
|
+
this.typeVerdicts.set(type, built);
|
|
164140
|
+
return built;
|
|
164141
|
+
}
|
|
164142
|
+
basesOf(type) {
|
|
164143
|
+
if (!type)
|
|
164144
|
+
return { bindings: [], complete: false };
|
|
164145
|
+
const cached = this.typeBases.get(type);
|
|
164146
|
+
if (cached)
|
|
164147
|
+
return cached;
|
|
164148
|
+
const built = baseTypeBindingsOf(type, this.resolve);
|
|
164149
|
+
this.typeBases.set(type, built);
|
|
164150
|
+
return built;
|
|
164151
|
+
}
|
|
164152
|
+
};
|
|
164153
|
+
var KEYWORDLESS_DECL_TYPES = /* @__PURE__ */ new Set(["EnumValueDecl", "BareDefDecl"]);
|
|
164154
|
+
function effectiveKindOf(node, annotations) {
|
|
164155
|
+
if (!KEYWORDLESS_DECL_TYPES.has(node.$type))
|
|
164156
|
+
return void 0;
|
|
164157
|
+
const isDef = node.$type === "BareDefDecl";
|
|
164158
|
+
for (const annotation of annotations) {
|
|
164159
|
+
const baseNode = annotation.base?.node;
|
|
164160
|
+
const declType = baseNode ? baseNode.$type : metaclassDeclTypeOf(annotation.base?.binding.castTypeName);
|
|
164161
|
+
if (!declType || declType === node.$type)
|
|
164162
|
+
continue;
|
|
164163
|
+
return { declType, isDef, from: annotation };
|
|
164164
|
+
}
|
|
164165
|
+
return void 0;
|
|
164166
|
+
}
|
|
164167
|
+
function effectiveKeywordOf(kind) {
|
|
164168
|
+
const words = kind.declType.replace(/Decl$/u, "").replace(/([A-Z])/gu, " $1").trim().toLowerCase();
|
|
164169
|
+
const keyword = words === "calc" ? "calc" : words;
|
|
164170
|
+
return kind.isDef ? `${keyword} def` : keyword;
|
|
164171
|
+
}
|
|
164172
|
+
function isKeywordlessDeclaration(node) {
|
|
164173
|
+
return KEYWORDLESS_DECL_TYPES.has(node.$type);
|
|
164174
|
+
}
|
|
164175
|
+
function isMetadataDefinition(node) {
|
|
164176
|
+
return node.$type === "MetadataDecl" && node.isDef === true;
|
|
164177
|
+
}
|
|
164178
|
+
function statesOwnBaseTypeOptionally(node) {
|
|
164179
|
+
const decl = node;
|
|
164180
|
+
return nameOf(node) === SEMANTIC_METADATA || (decl.modifiers ?? []).includes("abstract");
|
|
164181
|
+
}
|
|
164182
|
+
function metaclassDeclTypeOf(name) {
|
|
164183
|
+
if (!name)
|
|
164184
|
+
return void 0;
|
|
164185
|
+
const simple = simpleNameOf(name).replace(/(?:Usage|Definition)$/u, "");
|
|
164186
|
+
return METACLASS_DECL_TYPES[simple];
|
|
164187
|
+
}
|
|
164188
|
+
var METACLASS_DECL_TYPES = Object.freeze({
|
|
164189
|
+
Part: "PartDecl",
|
|
164190
|
+
Item: "ItemDecl",
|
|
164191
|
+
Port: "PortDecl",
|
|
164192
|
+
Attribute: "AttributeDecl",
|
|
164193
|
+
Action: "ActionDecl",
|
|
164194
|
+
State: "StateDecl",
|
|
164195
|
+
Occurrence: "OccurrenceDecl",
|
|
164196
|
+
Event: "EventDecl",
|
|
164197
|
+
Connection: "ConnectionDecl",
|
|
164198
|
+
Interface: "InterfaceDecl",
|
|
164199
|
+
Allocation: "AllocationDecl",
|
|
164200
|
+
Constraint: "ConstraintDecl",
|
|
164201
|
+
Requirement: "RequirementDecl",
|
|
164202
|
+
Concern: "ConcernDecl",
|
|
164203
|
+
Case: "CaseDecl",
|
|
164204
|
+
UseCase: "UseCaseDecl",
|
|
164205
|
+
AnalysisCase: "AnalysisCaseDecl",
|
|
164206
|
+
VerificationCase: "VerificationCaseDecl",
|
|
164207
|
+
Calculation: "CalcDecl",
|
|
164208
|
+
View: "ViewDecl",
|
|
164209
|
+
Viewpoint: "ViewpointDecl",
|
|
164210
|
+
Rendering: "RenderingDecl",
|
|
164211
|
+
Enumeration: "EnumDecl",
|
|
164212
|
+
Metadata: "MetadataDecl"
|
|
164213
|
+
});
|
|
164214
|
+
function metadataUsagesAnnotating(node) {
|
|
164215
|
+
const container = node.$container;
|
|
164216
|
+
const candidates = [];
|
|
164217
|
+
if (container?.$type === "PrefixMetadataMember")
|
|
164218
|
+
candidates.push(...container.tags ?? []);
|
|
164219
|
+
candidates.push(...node.members ?? []);
|
|
164220
|
+
const siblings = container?.members ?? container?.elements;
|
|
164221
|
+
if (siblings) {
|
|
164222
|
+
const index2 = siblings.indexOf(node);
|
|
164223
|
+
for (let before = index2 - 1; before >= 0; before -= 1) {
|
|
164224
|
+
const candidate = siblings[before];
|
|
164225
|
+
if (candidate.$type !== "MetadataAnnotation")
|
|
164226
|
+
break;
|
|
164227
|
+
candidates.push(candidate);
|
|
164228
|
+
}
|
|
164229
|
+
}
|
|
164230
|
+
return candidates.filter((candidate) => (isMetadataUsage(candidate) || isMetadataPrefixTag(candidate)) && annotatedOwnerOf(candidate) === node);
|
|
164231
|
+
}
|
|
164232
|
+
function metadataNameResolver(sources) {
|
|
164233
|
+
return (name, from) => {
|
|
164234
|
+
const normalized = name.trim();
|
|
164235
|
+
if (!normalized)
|
|
164236
|
+
return void 0;
|
|
164237
|
+
if (from) {
|
|
164238
|
+
const scoped = sources.visibleCandidates(from, normalized);
|
|
164239
|
+
if (scoped.length === 1)
|
|
164240
|
+
return scoped[0];
|
|
164241
|
+
}
|
|
164242
|
+
let descriptions = sources.descriptionsFor(normalized);
|
|
164243
|
+
if (descriptions.length === 0) {
|
|
164244
|
+
const simple = simpleNameOf(normalized);
|
|
164245
|
+
descriptions = simple ? sources.descriptionsFor(simple) : [];
|
|
164246
|
+
}
|
|
164247
|
+
if (descriptions.length === 0)
|
|
164248
|
+
return void 0;
|
|
164249
|
+
const unique = /* @__PURE__ */ new Map();
|
|
164250
|
+
for (const description of descriptions) {
|
|
164251
|
+
unique.set(`${String(description.documentUri)}#${description.path}`, description);
|
|
164252
|
+
}
|
|
164253
|
+
if (unique.size !== 1)
|
|
164254
|
+
return void 0;
|
|
164255
|
+
return sources.nodeFor([...unique.values()][0]);
|
|
164256
|
+
};
|
|
164257
|
+
}
|
|
164258
|
+
function specializationTargetsOf2(node) {
|
|
164259
|
+
const owner = node;
|
|
164260
|
+
const targets = [];
|
|
164261
|
+
for (const relationship of [...owner.preRelationships ?? [], ...owner.relationships ?? []]) {
|
|
164262
|
+
if (relationship.kind && SPECIALIZATION_KINDS3.has(relationship.kind)) {
|
|
164263
|
+
targets.push(...relationship.targets ?? []);
|
|
164264
|
+
}
|
|
164265
|
+
}
|
|
164266
|
+
const typed = owner.typing?.type?.$refText;
|
|
164267
|
+
if (typed)
|
|
164268
|
+
targets.push(typed);
|
|
164269
|
+
return targets.map((target) => target.trim()).filter((target) => target.length > 0);
|
|
164270
|
+
}
|
|
164271
|
+
function boundFeatureNameOf(member) {
|
|
164272
|
+
for (const relationship of [...member.preRelationships ?? [], ...member.relationships ?? []]) {
|
|
164273
|
+
if (relationship.kind !== ":>>" && relationship.kind !== "redefines")
|
|
164274
|
+
continue;
|
|
164275
|
+
const simple = simpleNameOf((relationship.targets ?? [])[0] ?? "");
|
|
164276
|
+
if (simple)
|
|
164277
|
+
return simple;
|
|
164278
|
+
}
|
|
164279
|
+
return member.name;
|
|
164280
|
+
}
|
|
164281
|
+
function nameOf(node) {
|
|
164282
|
+
return node.name;
|
|
164283
|
+
}
|
|
164284
|
+
function simpleNameOf(written) {
|
|
164285
|
+
return written.split(/::|\./u).pop()?.trim() ?? "";
|
|
164286
|
+
}
|
|
164287
|
+
function pathTextOf2(node) {
|
|
164288
|
+
if (!node)
|
|
164289
|
+
return void 0;
|
|
164290
|
+
const written = node.path?.trim() ?? node.$cstNode?.text?.trim();
|
|
164291
|
+
return written && written.length > 0 ? written : void 0;
|
|
164292
|
+
}
|
|
164293
|
+
|
|
163508
164294
|
// ../language-server/out/src/services/feature-path-resolver.js
|
|
163509
164295
|
function isPublic(node) {
|
|
163510
164296
|
for (let current2 = node; current2; current2 = current2.$container) {
|
|
@@ -163517,28 +164303,30 @@ function isPublic(node) {
|
|
|
163517
164303
|
}
|
|
163518
164304
|
return true;
|
|
163519
164305
|
}
|
|
163520
|
-
var
|
|
164306
|
+
var SPECIALIZATION_KINDS4 = /* @__PURE__ */ new Set([":>", ":>>", "specializes", "subsets", "redefines"]);
|
|
163521
164307
|
var inheritanceByNode = /* @__PURE__ */ new WeakMap();
|
|
163522
164308
|
function inheritanceSyntax(node) {
|
|
163523
164309
|
const cached = inheritanceByNode.get(node);
|
|
163524
164310
|
if (cached)
|
|
163525
164311
|
return cached;
|
|
163526
164312
|
const shape = node;
|
|
163527
|
-
const relationships = [...shape.preRelationships ?? [], ...shape.relationships ?? []].filter((relation) => relation.kind &&
|
|
164313
|
+
const relationships = [...shape.preRelationships ?? [], ...shape.relationships ?? []].filter((relation) => relation.kind && SPECIALIZATION_KINDS4.has(relation.kind));
|
|
163528
164314
|
const implicitVariant = implicitVariantSpecialization(node)?.target;
|
|
163529
164315
|
const externalVariant = !!externalVariantPath(node);
|
|
163530
164316
|
const enumUsage = node.$type === "EnumDecl" && shape.isDef !== true;
|
|
164317
|
+
const semanticTags = metadataUsagesAnnotating(node);
|
|
163531
164318
|
const result = {
|
|
163532
164319
|
relationships,
|
|
163533
164320
|
implicitVariant,
|
|
163534
164321
|
externalVariant,
|
|
163535
164322
|
enumUsage,
|
|
163536
|
-
|
|
164323
|
+
semanticTags,
|
|
164324
|
+
hasSources: !!shape.typing || relationships.length > 0 || !!implicitVariant || externalVariant || enumUsage || semanticTags.length > 0
|
|
163537
164325
|
};
|
|
163538
164326
|
inheritanceByNode.set(node, result);
|
|
163539
164327
|
return result;
|
|
163540
164328
|
}
|
|
163541
|
-
function
|
|
164329
|
+
function nameOf2(node) {
|
|
163542
164330
|
if (node) {
|
|
163543
164331
|
const external = externalVariantName(node);
|
|
163544
164332
|
if (external)
|
|
@@ -163611,7 +164399,7 @@ function directNamedChildren(node) {
|
|
|
163611
164399
|
const child = unwrap(raw);
|
|
163612
164400
|
if (isReferenceFormDeclaration(child))
|
|
163613
164401
|
continue;
|
|
163614
|
-
if (!
|
|
164402
|
+
if (!nameOf2(child) || seen.has(child))
|
|
163615
164403
|
continue;
|
|
163616
164404
|
seen.add(child);
|
|
163617
164405
|
result.push(child);
|
|
@@ -163622,7 +164410,7 @@ function directNamedChildren(node) {
|
|
|
163622
164410
|
function hasName(node, name) {
|
|
163623
164411
|
const shortName = node.shortName?.name;
|
|
163624
164412
|
const requested = decodeUnrestrictedName(name);
|
|
163625
|
-
return [
|
|
164413
|
+
return [nameOf2(node), shortName ? canonicalEscapedName(shortName) : void 0].some((candidate) => candidate !== void 0 && decodeUnrestrictedName(candidate) === requested);
|
|
163626
164414
|
}
|
|
163627
164415
|
function matchingChildren(node, name) {
|
|
163628
164416
|
let index2 = childrenByName.get(node);
|
|
@@ -163630,7 +164418,7 @@ function matchingChildren(node, name) {
|
|
|
163630
164418
|
index2 = /* @__PURE__ */ new Map();
|
|
163631
164419
|
for (const child of directNamedChildren(node)) {
|
|
163632
164420
|
const shortName = child.shortName?.name;
|
|
163633
|
-
const aliases = [
|
|
164421
|
+
const aliases = [nameOf2(child), shortName ? canonicalEscapedName(shortName) : void 0];
|
|
163634
164422
|
for (const alias of new Set(aliases.filter((value) => value !== void 0).map(decodeUnrestrictedName))) {
|
|
163635
164423
|
const matches = index2.get(alias) ?? [];
|
|
163636
164424
|
matches.push(child);
|
|
@@ -163718,6 +164506,10 @@ var FeaturePathResolver = class {
|
|
|
163718
164506
|
owners = /* @__PURE__ */ new WeakMap();
|
|
163719
164507
|
propertySegments = /* @__PURE__ */ new WeakMap();
|
|
163720
164508
|
resolvingSpecializations = /* @__PURE__ */ new Set();
|
|
164509
|
+
/** issue #169 - re-entrancy guard for the semantic-metadata base walk. It
|
|
164510
|
+
* resolves the `baseType` path through `scopedSpecializationTarget`, which
|
|
164511
|
+
* runs the owner walk, which asks for the semantic base again. */
|
|
164512
|
+
resolvingSemanticBases = /* @__PURE__ */ new Set();
|
|
163721
164513
|
enumerationPathDepth = 0;
|
|
163722
164514
|
constructor(services) {
|
|
163723
164515
|
this.indexManager = services?.shared.workspace.IndexManager;
|
|
@@ -164094,7 +164886,7 @@ var FeaturePathResolver = class {
|
|
|
164094
164886
|
resolveRoot(node, name, snapshot) {
|
|
164095
164887
|
if (name === "self" || name === "this" || name === "that") {
|
|
164096
164888
|
for (let owner = node.$container; owner; owner = owner.$container) {
|
|
164097
|
-
if (
|
|
164889
|
+
if (nameOf2(owner)) {
|
|
164098
164890
|
return this.targetForNode(owner, this.memberInventoryKnown(owner, snapshot));
|
|
164099
164891
|
}
|
|
164100
164892
|
}
|
|
@@ -164172,7 +164964,7 @@ var FeaturePathResolver = class {
|
|
|
164172
164964
|
const declared = [
|
|
164173
164965
|
...record.preRelationships ?? [],
|
|
164174
164966
|
...record.relationships ?? []
|
|
164175
|
-
].filter((relation) => relation !== under && relation.kind &&
|
|
164967
|
+
].filter((relation) => relation !== under && relation.kind && SPECIALIZATION_KINDS4.has(relation.kind));
|
|
164176
164968
|
if (declared.length === 0)
|
|
164177
164969
|
return true;
|
|
164178
164970
|
const written = declared.reduce((total, relation) => total + (relation.targets?.length ?? 0), 0);
|
|
@@ -164216,7 +165008,7 @@ var FeaturePathResolver = class {
|
|
|
164216
165008
|
const syntax = inheritanceSyntax(node);
|
|
164217
165009
|
if (!syntax.hasSources)
|
|
164218
165010
|
return [];
|
|
164219
|
-
const cacheable = this.resolvingSpecializations.size === 0;
|
|
165011
|
+
const cacheable = this.resolvingSpecializations.size === 0 && this.resolvingSemanticBases.size === 0;
|
|
164220
165012
|
const depthZero = this.enumerationPathDepth === 0;
|
|
164221
165013
|
const cached = this.owners.get(node);
|
|
164222
165014
|
if (cached && cached.snapshot === snapshot && cached.depthZero === depthZero)
|
|
@@ -164236,6 +165028,8 @@ var FeaturePathResolver = class {
|
|
|
164236
165028
|
visit(inheritedSyntax.implicitVariant);
|
|
164237
165029
|
visit(this.inferredEnumerationTarget(candidate));
|
|
164238
165030
|
visit(this.isEnumUsage(candidate) ? this.enumerationTypingTarget(candidate) : this.typingTarget(candidate, snapshot));
|
|
165031
|
+
for (const base of this.semanticBaseTargets(candidate, inheritedSyntax, snapshot))
|
|
165032
|
+
visit(base);
|
|
164239
165033
|
for (const specialized of this.specializationTargets(candidate, snapshot))
|
|
164240
165034
|
visit(specialized);
|
|
164241
165035
|
};
|
|
@@ -164249,6 +165043,8 @@ var FeaturePathResolver = class {
|
|
|
164249
165043
|
visit(type);
|
|
164250
165044
|
}
|
|
164251
165045
|
visit(this.isEnumUsage(node) ? this.enumerationTypingTarget(node) : this.typingTarget(node, snapshot));
|
|
165046
|
+
for (const base of this.semanticBaseTargets(node, syntax, snapshot))
|
|
165047
|
+
visit(base);
|
|
164252
165048
|
for (const specialized of this.specializationTargets(node, snapshot))
|
|
164253
165049
|
visit(specialized);
|
|
164254
165050
|
if (cacheable)
|
|
@@ -164312,6 +165108,88 @@ var FeaturePathResolver = class {
|
|
|
164312
165108
|
}
|
|
164313
165109
|
return typed;
|
|
164314
165110
|
}
|
|
165111
|
+
/**
|
|
165112
|
+
* issue #169 - the base type a user-defined keyword gives a declaration.
|
|
165113
|
+
*
|
|
165114
|
+
* OMG SysML v2 Part 1 §7.27.4: `#subsystem engine;` IS `part engine :>
|
|
165115
|
+
* subsystems;`, so the scope walk has to reach `subsystems`' members from
|
|
165116
|
+
* `engine` exactly as a written `:>` would. The tag's metadata definition is
|
|
165117
|
+
* already a resolved cross-reference, and its `baseType` is a written path
|
|
165118
|
+
* read in the DEFINITION's scope, which is what
|
|
165119
|
+
* {@link scopedSpecializationTarget} answers - so this adds no resolver of
|
|
165120
|
+
* its own.
|
|
165121
|
+
*
|
|
165122
|
+
* That resolver runs the owner walk, though, and the owner walk asks for the
|
|
165123
|
+
* semantic base again, so the two call each other. `resolvingSemanticBases`
|
|
165124
|
+
* is what stops that: while a node's base is being resolved, asking for it
|
|
165125
|
+
* again answers "none" rather than recursing, exactly as
|
|
165126
|
+
* `resolvingSpecializations` guards the written walk beside it. The cycle
|
|
165127
|
+
* needs the library keywords to close, so what covers it is
|
|
165128
|
+
* `packages/extension/test/diagram/annex-a-layout.test.ts`, whose Annex A
|
|
165129
|
+
* source carries `#mop`, `#logical` and `#derivation`.
|
|
165130
|
+
*
|
|
165131
|
+
* EVERY tag that names a readable base contributes, in document order and
|
|
165132
|
+
* deduplicated. Two tags state two edges, and a member reachable only
|
|
165133
|
+
* through the second one has to resolve too; only the effective KIND is
|
|
165134
|
+
* first-tag-wins, because one element cannot be two kinds (Codex review of
|
|
165135
|
+
* PR 294).
|
|
165136
|
+
*/
|
|
165137
|
+
// REQ-420 — SemanticMetadata and user-defined keyword specialization
|
|
165138
|
+
semanticBaseTargets(node, syntax, snapshot) {
|
|
165139
|
+
if (syntax.semanticTags.length === 0 || this.resolvingSemanticBases.has(node))
|
|
165140
|
+
return [];
|
|
165141
|
+
this.resolvingSemanticBases.add(node);
|
|
165142
|
+
try {
|
|
165143
|
+
const resolve8 = (name, from) => this.semanticPathTarget(name, from ?? node, snapshot);
|
|
165144
|
+
const bases = [];
|
|
165145
|
+
for (const tag of syntax.semanticTags) {
|
|
165146
|
+
const type = metadataTypeNodeOf(tag, resolve8);
|
|
165147
|
+
if (!type || !semanticMetadataVerdictOf(type, resolve8).isSemantic)
|
|
165148
|
+
continue;
|
|
165149
|
+
const binding = baseTypeBindingsOf(type, resolve8).bindings[0];
|
|
165150
|
+
if (!binding)
|
|
165151
|
+
continue;
|
|
165152
|
+
const base = resolve8(binding.written, binding.node) ?? resolve8(binding.written, binding.owner);
|
|
165153
|
+
if (base && base !== node && !bases.includes(base))
|
|
165154
|
+
bases.push(base);
|
|
165155
|
+
}
|
|
165156
|
+
return bases;
|
|
165157
|
+
} finally {
|
|
165158
|
+
this.resolvingSemanticBases.delete(node);
|
|
165159
|
+
}
|
|
165160
|
+
}
|
|
165161
|
+
/**
|
|
165162
|
+
* issue #169 - resolve one written path from a semantic metadata definition.
|
|
165163
|
+
*
|
|
165164
|
+
* `scopedSpecializationTarget` answers a SIMPLE name, and the libraries write
|
|
165165
|
+
* qualified ones: `baseType = SDDD::idds` in `AHFProfileLib.sysml`,
|
|
165166
|
+
* `system_of_systems::locclouds` beside it. Rejecting a name with separators
|
|
165167
|
+
* left those keywords with no inherited members at all, so the root segment
|
|
165168
|
+
* is resolved in the definition's scope and the rest is a member descent,
|
|
165169
|
+
* inherited members included (Codex review of PR 294).
|
|
165170
|
+
*/
|
|
165171
|
+
semanticPathTarget(written, from, snapshot) {
|
|
165172
|
+
const segments = written.split(/::|\./u).map((segment) => simpleRelationName(segment.trim())).filter((segment) => !!segment);
|
|
165173
|
+
if (segments.length === 0)
|
|
165174
|
+
return void 0;
|
|
165175
|
+
let current2 = this.scopedSpecializationTarget(from, segments[0], snapshot);
|
|
165176
|
+
for (let index2 = 1; current2 && index2 < segments.length; index2 += 1) {
|
|
165177
|
+
const name = segments[index2];
|
|
165178
|
+
const own = matchingChildren(current2, name)[0];
|
|
165179
|
+
if (own) {
|
|
165180
|
+
current2 = own;
|
|
165181
|
+
continue;
|
|
165182
|
+
}
|
|
165183
|
+
let inherited;
|
|
165184
|
+
for (const owner of this.typedAndSpecializedOwners(current2, snapshot)) {
|
|
165185
|
+
inherited = matchingChildren(owner, name)[0];
|
|
165186
|
+
if (inherited)
|
|
165187
|
+
break;
|
|
165188
|
+
}
|
|
165189
|
+
current2 = inherited;
|
|
165190
|
+
}
|
|
165191
|
+
return current2;
|
|
165192
|
+
}
|
|
164315
165193
|
specializationTargets(node, snapshot) {
|
|
164316
165194
|
const { relationships } = inheritanceSyntax(node);
|
|
164317
165195
|
if (relationships.length === 0 || this.resolvingSpecializations.has(node))
|
|
@@ -164373,7 +165251,7 @@ var FeaturePathResolver = class {
|
|
|
164373
165251
|
}
|
|
164374
165252
|
}
|
|
164375
165253
|
targetForNode(node, certain = false) {
|
|
164376
|
-
const name =
|
|
165254
|
+
const name = nameOf2(node);
|
|
164377
165255
|
let description;
|
|
164378
165256
|
if (name && this.descriptions) {
|
|
164379
165257
|
try {
|
|
@@ -164425,7 +165303,7 @@ var FeaturePathResolver = class {
|
|
|
164425
165303
|
}
|
|
164426
165304
|
} else {
|
|
164427
165305
|
for (const node of [root4, ...ast_utils_exports.streamAllContents(root4)]) {
|
|
164428
|
-
const name =
|
|
165306
|
+
const name = nameOf2(node);
|
|
164429
165307
|
if (!name)
|
|
164430
165308
|
continue;
|
|
164431
165309
|
const values2 = byName.get(name) ?? [];
|
|
@@ -164453,138 +165331,6 @@ var FeaturePathResolver = class {
|
|
|
164453
165331
|
}
|
|
164454
165332
|
};
|
|
164455
165333
|
|
|
164456
|
-
// ../language-server/out/src/services/calculation-semantics.js
|
|
164457
|
-
function effectiveCalculationResult(node, resolve8) {
|
|
164458
|
-
const seen = /* @__PURE__ */ new Set();
|
|
164459
|
-
const walk = (current2, depth) => {
|
|
164460
|
-
if (depth > 32 || seen.has(current2))
|
|
164461
|
-
return void 0;
|
|
164462
|
-
seen.add(current2);
|
|
164463
|
-
const parameter = current2.members?.find((member) => member.$type === "ReturnDecl");
|
|
164464
|
-
if (parameter || current2.body)
|
|
164465
|
-
return {
|
|
164466
|
-
parameter,
|
|
164467
|
-
expression: parameter?.value ?? current2.body,
|
|
164468
|
-
inherited: current2 !== node
|
|
164469
|
-
};
|
|
164470
|
-
const parents = supertypesOf(current2, resolve8).filter((parent) => parent.$type === "CalcDecl");
|
|
164471
|
-
if (parents.length !== 1)
|
|
164472
|
-
return void 0;
|
|
164473
|
-
return walk(parents[0], depth + 1);
|
|
164474
|
-
};
|
|
164475
|
-
return walk(node, 0);
|
|
164476
|
-
}
|
|
164477
|
-
|
|
164478
|
-
// ../language-server/out/src/platform/platform.js
|
|
164479
|
-
var current;
|
|
164480
|
-
function setPlatform(platform) {
|
|
164481
|
-
current = platform;
|
|
164482
|
-
}
|
|
164483
|
-
function getPlatform() {
|
|
164484
|
-
if (!current)
|
|
164485
|
-
throw new Error("SysML: no platform installed - the entry point must call setPlatform() first.");
|
|
164486
|
-
return current;
|
|
164487
|
-
}
|
|
164488
|
-
function hasPlatform() {
|
|
164489
|
-
return current !== void 0;
|
|
164490
|
-
}
|
|
164491
|
-
|
|
164492
|
-
// ../language-server/out/src/services/library-index-manager.js
|
|
164493
|
-
var SysmlIndexManager = class extends DefaultIndexManager {
|
|
164494
|
-
constructor(services) {
|
|
164495
|
-
super(services);
|
|
164496
|
-
}
|
|
164497
|
-
// REQ-075, REQ-383 — `libraryRoot` is a URI and the concrete file URIs come
|
|
164498
|
-
// from the platform, because the two hosts index the same library under
|
|
164499
|
-
// different schemes (`file:` on the desktop, `sysml-lib:` in a worker).
|
|
164500
|
-
loadPrecomputedLibraryIndex(index2, libraryRoot) {
|
|
164501
|
-
const platform = getPlatform();
|
|
164502
|
-
let symbolCount = 0;
|
|
164503
|
-
for (const file of index2.files) {
|
|
164504
|
-
const documentUri = platform.libraryUri(libraryRoot, file.path);
|
|
164505
|
-
const descriptions = file.symbols.map((symbol) => this.deserializeSymbol(symbol, documentUri));
|
|
164506
|
-
const uri = documentUri.toString();
|
|
164507
|
-
this.symbolIndex.set(uri, descriptions);
|
|
164508
|
-
this.symbolByTypeIndex.clear(uri);
|
|
164509
|
-
symbolCount += descriptions.length;
|
|
164510
|
-
}
|
|
164511
|
-
return symbolCount;
|
|
164512
|
-
}
|
|
164513
|
-
deserializeSymbol(symbol, documentUri) {
|
|
164514
|
-
return {
|
|
164515
|
-
name: symbol.name,
|
|
164516
|
-
type: symbol.type,
|
|
164517
|
-
path: symbol.path,
|
|
164518
|
-
documentUri,
|
|
164519
|
-
nameSegment: symbol.nameSegment,
|
|
164520
|
-
selectionSegment: symbol.selectionSegment,
|
|
164521
|
-
// REQ-068 — preserve declared visibility for wildcard re-export.
|
|
164522
|
-
...symbol.isPrivate ? { isPrivate: true } : {},
|
|
164523
|
-
...symbol.visibility ? { visibility: symbol.visibility } : {},
|
|
164524
|
-
// issue #152 — a re-exported alias is not owned nesting.
|
|
164525
|
-
...symbol.derivedKind ? { derivedKind: symbol.derivedKind } : {},
|
|
164526
|
-
// REQ-242 — issue #103 — keeps type completion to definitions.
|
|
164527
|
-
...symbol.isUsage ? { isUsage: true } : {}
|
|
164528
|
-
};
|
|
164529
|
-
}
|
|
164530
|
-
};
|
|
164531
|
-
function isSysmlIndexManager(value) {
|
|
164532
|
-
return typeof value.loadPrecomputedLibraryIndex === "function";
|
|
164533
|
-
}
|
|
164534
|
-
var libraryRoots = /* @__PURE__ */ new Set();
|
|
164535
|
-
var ROOT_SEPARATOR = "\0";
|
|
164536
|
-
function normalizeLibraryPath(p) {
|
|
164537
|
-
return p.replace(/\\/gu, "/").replace(/\/+$/u, "").toLowerCase();
|
|
164538
|
-
}
|
|
164539
|
-
function registerLibraryRoot(root4) {
|
|
164540
|
-
const uri = typeof root4 === "string" ? root4.length > 0 ? URI2.file(root4) : void 0 : root4;
|
|
164541
|
-
if (!uri)
|
|
164542
|
-
return;
|
|
164543
|
-
libraryRoots.add(`${uri.scheme}${ROOT_SEPARATOR}${normalizeLibraryPath(uri.path)}`);
|
|
164544
|
-
}
|
|
164545
|
-
function isInsideDir(fsPath, dir) {
|
|
164546
|
-
return fsPath === dir || fsPath.startsWith(`${dir}/`);
|
|
164547
|
-
}
|
|
164548
|
-
function isStandardLibraryUri(uri) {
|
|
164549
|
-
const fsPath = normalizeLibraryPath(uri.path);
|
|
164550
|
-
for (const entry of libraryRoots) {
|
|
164551
|
-
const separator = entry.indexOf(ROOT_SEPARATOR);
|
|
164552
|
-
if (entry.slice(0, separator) !== uri.scheme)
|
|
164553
|
-
continue;
|
|
164554
|
-
if (isInsideDir(fsPath, entry.slice(separator + 1)))
|
|
164555
|
-
return true;
|
|
164556
|
-
}
|
|
164557
|
-
return fsPath.split("/").some((segment) => segment === "sysml.library");
|
|
164558
|
-
}
|
|
164559
|
-
function isLibraryDocument(doc) {
|
|
164560
|
-
return doc.isLibraryDocument === true || isStandardLibraryUri(doc.uri);
|
|
164561
|
-
}
|
|
164562
|
-
|
|
164563
|
-
// ../language-server/out/src/services/namespace-kind.js
|
|
164564
|
-
var KERML_CLASSIFIER_DECL_TYPES = /* @__PURE__ */ new Set([
|
|
164565
|
-
"AssociationDecl",
|
|
164566
|
-
"BehaviorDecl",
|
|
164567
|
-
"ClassDecl",
|
|
164568
|
-
"ClassifierDecl",
|
|
164569
|
-
"DatatypeDecl",
|
|
164570
|
-
"FunctionDecl",
|
|
164571
|
-
"InteractionDecl",
|
|
164572
|
-
"MetaclassDecl",
|
|
164573
|
-
"PredicateDecl",
|
|
164574
|
-
"StructDecl",
|
|
164575
|
-
"TypeDecl"
|
|
164576
|
-
]);
|
|
164577
|
-
function isNamespaceOnlyDecl(node) {
|
|
164578
|
-
if (isPackage(node) || node.$type === "NamespaceDecl" || node.$type === "BareDefDecl")
|
|
164579
|
-
return true;
|
|
164580
|
-
if (KERML_CLASSIFIER_DECL_TYPES.has(node.$type))
|
|
164581
|
-
return true;
|
|
164582
|
-
return node.isDef === true;
|
|
164583
|
-
}
|
|
164584
|
-
function memberSeparator(owner) {
|
|
164585
|
-
return isDocument(owner) || isNamespaceOnlyDecl(owner) ? "::" : ".";
|
|
164586
|
-
}
|
|
164587
|
-
|
|
164588
165334
|
// ../language-server/out/src/services/name-lookup.js
|
|
164589
165335
|
function unquoteName(name) {
|
|
164590
165336
|
return name.replace(/^'(.*)'$/u, "$1");
|
|
@@ -164616,7 +165362,7 @@ function pathSegments2(path10) {
|
|
|
164616
165362
|
segments.push(current2);
|
|
164617
165363
|
return segments;
|
|
164618
165364
|
}
|
|
164619
|
-
function
|
|
165365
|
+
function simpleNameOf2(name) {
|
|
164620
165366
|
return pathSegments2(name).at(-1) ?? name;
|
|
164621
165367
|
}
|
|
164622
165368
|
var ELEMENT_SEPARATOR = "\0";
|
|
@@ -164672,7 +165418,7 @@ var SysmlNameLookup = class {
|
|
|
164672
165418
|
* its final segment. Both readings must name exactly one element.
|
|
164673
165419
|
*/
|
|
164674
165420
|
uniqueForPath(path10, accept) {
|
|
164675
|
-
return this.unique(path10, accept) ?? this.unique(
|
|
165421
|
+
return this.unique(path10, accept) ?? this.unique(simpleNameOf2(path10), accept);
|
|
164676
165422
|
}
|
|
164677
165423
|
/**
|
|
164678
165424
|
* The declared spellings of the element `description` names — its regular
|
|
@@ -164736,8 +165482,140 @@ function nameLookupFor(shared) {
|
|
|
164736
165482
|
return created;
|
|
164737
165483
|
}
|
|
164738
165484
|
|
|
165485
|
+
// ../language-server/out/src/services/calculation-semantics.js
|
|
165486
|
+
function effectiveCalculationResult(node, resolve8) {
|
|
165487
|
+
const seen = /* @__PURE__ */ new Set();
|
|
165488
|
+
const walk = (current2, depth) => {
|
|
165489
|
+
if (depth > 32 || seen.has(current2))
|
|
165490
|
+
return void 0;
|
|
165491
|
+
seen.add(current2);
|
|
165492
|
+
const parameter = current2.members?.find((member) => member.$type === "ReturnDecl");
|
|
165493
|
+
if (parameter || current2.body)
|
|
165494
|
+
return {
|
|
165495
|
+
parameter,
|
|
165496
|
+
expression: parameter?.value ?? current2.body,
|
|
165497
|
+
inherited: current2 !== node
|
|
165498
|
+
};
|
|
165499
|
+
const parents = supertypesOf(current2, resolve8).filter((parent) => parent.$type === "CalcDecl");
|
|
165500
|
+
if (parents.length !== 1)
|
|
165501
|
+
return void 0;
|
|
165502
|
+
return walk(parents[0], depth + 1);
|
|
165503
|
+
};
|
|
165504
|
+
return walk(node, 0);
|
|
165505
|
+
}
|
|
165506
|
+
|
|
165507
|
+
// ../language-server/out/src/platform/platform.js
|
|
165508
|
+
var current;
|
|
165509
|
+
function setPlatform(platform) {
|
|
165510
|
+
current = platform;
|
|
165511
|
+
}
|
|
165512
|
+
function getPlatform() {
|
|
165513
|
+
if (!current)
|
|
165514
|
+
throw new Error("SysML: no platform installed - the entry point must call setPlatform() first.");
|
|
165515
|
+
return current;
|
|
165516
|
+
}
|
|
165517
|
+
function hasPlatform() {
|
|
165518
|
+
return current !== void 0;
|
|
165519
|
+
}
|
|
165520
|
+
|
|
165521
|
+
// ../language-server/out/src/services/library-index-manager.js
|
|
165522
|
+
var SysmlIndexManager = class extends DefaultIndexManager {
|
|
165523
|
+
constructor(services) {
|
|
165524
|
+
super(services);
|
|
165525
|
+
}
|
|
165526
|
+
// REQ-075, REQ-383 — `libraryRoot` is a URI and the concrete file URIs come
|
|
165527
|
+
// from the platform, because the two hosts index the same library under
|
|
165528
|
+
// different schemes (`file:` on the desktop, `sysml-lib:` in a worker).
|
|
165529
|
+
loadPrecomputedLibraryIndex(index2, libraryRoot) {
|
|
165530
|
+
const platform = getPlatform();
|
|
165531
|
+
let symbolCount = 0;
|
|
165532
|
+
for (const file of index2.files) {
|
|
165533
|
+
const documentUri = platform.libraryUri(libraryRoot, file.path);
|
|
165534
|
+
const descriptions = file.symbols.map((symbol) => this.deserializeSymbol(symbol, documentUri));
|
|
165535
|
+
const uri = documentUri.toString();
|
|
165536
|
+
this.symbolIndex.set(uri, descriptions);
|
|
165537
|
+
this.symbolByTypeIndex.clear(uri);
|
|
165538
|
+
symbolCount += descriptions.length;
|
|
165539
|
+
}
|
|
165540
|
+
return symbolCount;
|
|
165541
|
+
}
|
|
165542
|
+
deserializeSymbol(symbol, documentUri) {
|
|
165543
|
+
return {
|
|
165544
|
+
name: symbol.name,
|
|
165545
|
+
type: symbol.type,
|
|
165546
|
+
path: symbol.path,
|
|
165547
|
+
documentUri,
|
|
165548
|
+
nameSegment: symbol.nameSegment,
|
|
165549
|
+
selectionSegment: symbol.selectionSegment,
|
|
165550
|
+
// REQ-068 — preserve declared visibility for wildcard re-export.
|
|
165551
|
+
...symbol.isPrivate ? { isPrivate: true } : {},
|
|
165552
|
+
...symbol.visibility ? { visibility: symbol.visibility } : {},
|
|
165553
|
+
// issue #152 — a re-exported alias is not owned nesting.
|
|
165554
|
+
...symbol.derivedKind ? { derivedKind: symbol.derivedKind } : {},
|
|
165555
|
+
// REQ-242 — issue #103 — keeps type completion to definitions.
|
|
165556
|
+
...symbol.isUsage ? { isUsage: true } : {}
|
|
165557
|
+
};
|
|
165558
|
+
}
|
|
165559
|
+
};
|
|
165560
|
+
function isSysmlIndexManager(value) {
|
|
165561
|
+
return typeof value.loadPrecomputedLibraryIndex === "function";
|
|
165562
|
+
}
|
|
165563
|
+
var libraryRoots = /* @__PURE__ */ new Set();
|
|
165564
|
+
var ROOT_SEPARATOR = "\0";
|
|
165565
|
+
function normalizeLibraryPath(p) {
|
|
165566
|
+
return p.replace(/\\/gu, "/").replace(/\/+$/u, "").toLowerCase();
|
|
165567
|
+
}
|
|
165568
|
+
function registerLibraryRoot(root4) {
|
|
165569
|
+
const uri = typeof root4 === "string" ? root4.length > 0 ? URI2.file(root4) : void 0 : root4;
|
|
165570
|
+
if (!uri)
|
|
165571
|
+
return;
|
|
165572
|
+
libraryRoots.add(`${uri.scheme}${ROOT_SEPARATOR}${normalizeLibraryPath(uri.path)}`);
|
|
165573
|
+
}
|
|
165574
|
+
function isInsideDir(fsPath, dir) {
|
|
165575
|
+
return fsPath === dir || fsPath.startsWith(`${dir}/`);
|
|
165576
|
+
}
|
|
165577
|
+
function isStandardLibraryUri(uri) {
|
|
165578
|
+
const fsPath = normalizeLibraryPath(uri.path);
|
|
165579
|
+
for (const entry of libraryRoots) {
|
|
165580
|
+
const separator = entry.indexOf(ROOT_SEPARATOR);
|
|
165581
|
+
if (entry.slice(0, separator) !== uri.scheme)
|
|
165582
|
+
continue;
|
|
165583
|
+
if (isInsideDir(fsPath, entry.slice(separator + 1)))
|
|
165584
|
+
return true;
|
|
165585
|
+
}
|
|
165586
|
+
return fsPath.split("/").some((segment) => segment === "sysml.library");
|
|
165587
|
+
}
|
|
165588
|
+
function isLibraryDocument(doc) {
|
|
165589
|
+
return doc.isLibraryDocument === true || isStandardLibraryUri(doc.uri);
|
|
165590
|
+
}
|
|
165591
|
+
|
|
165592
|
+
// ../language-server/out/src/services/namespace-kind.js
|
|
165593
|
+
var KERML_CLASSIFIER_DECL_TYPES = /* @__PURE__ */ new Set([
|
|
165594
|
+
"AssociationDecl",
|
|
165595
|
+
"BehaviorDecl",
|
|
165596
|
+
"ClassDecl",
|
|
165597
|
+
"ClassifierDecl",
|
|
165598
|
+
"DatatypeDecl",
|
|
165599
|
+
"FunctionDecl",
|
|
165600
|
+
"InteractionDecl",
|
|
165601
|
+
"MetaclassDecl",
|
|
165602
|
+
"PredicateDecl",
|
|
165603
|
+
"StructDecl",
|
|
165604
|
+
"TypeDecl"
|
|
165605
|
+
]);
|
|
165606
|
+
function isNamespaceOnlyDecl(node) {
|
|
165607
|
+
if (isPackage(node) || node.$type === "NamespaceDecl" || node.$type === "BareDefDecl")
|
|
165608
|
+
return true;
|
|
165609
|
+
if (KERML_CLASSIFIER_DECL_TYPES.has(node.$type))
|
|
165610
|
+
return true;
|
|
165611
|
+
return node.isDef === true;
|
|
165612
|
+
}
|
|
165613
|
+
function memberSeparator(owner) {
|
|
165614
|
+
return isDocument(owner) || isNamespaceOnlyDecl(owner) ? "::" : ".";
|
|
165615
|
+
}
|
|
165616
|
+
|
|
164739
165617
|
// ../language-server/out/src/services/effective-name.js
|
|
164740
|
-
var
|
|
165618
|
+
var REDEFINITION_KINDS3 = /* @__PURE__ */ new Set([":>>", "redefines"]);
|
|
164741
165619
|
var NO_CANDIDATES = [];
|
|
164742
165620
|
var NO_RESOLVER = () => NO_CANDIDATES;
|
|
164743
165621
|
var nameable = /* @__PURE__ */ new Map();
|
|
@@ -164771,7 +165649,7 @@ function firstRedefinitionPath(node) {
|
|
|
164771
165649
|
for (const relationship of group) {
|
|
164772
165650
|
if (typeof relationship?.kind !== "string")
|
|
164773
165651
|
continue;
|
|
164774
|
-
if (!
|
|
165652
|
+
if (!REDEFINITION_KINDS3.has(relationship.kind))
|
|
164775
165653
|
continue;
|
|
164776
165654
|
const targets = relationship.targets;
|
|
164777
165655
|
if (!Array.isArray(targets))
|
|
@@ -164785,7 +165663,7 @@ function firstRedefinitionPath(node) {
|
|
|
164785
165663
|
return void 0;
|
|
164786
165664
|
}
|
|
164787
165665
|
function writtenNameOf(path10) {
|
|
164788
|
-
const segment =
|
|
165666
|
+
const segment = simpleNameOf2(path10).replace(/\s*\[[^\]]*\]\s*$/u, "").trim();
|
|
164789
165667
|
return segment.length > 0 ? segment : void 0;
|
|
164790
165668
|
}
|
|
164791
165669
|
var memos = /* @__PURE__ */ new WeakMap();
|
|
@@ -165816,7 +166694,7 @@ function nearestUnits(symbol, limit) {
|
|
|
165816
166694
|
}
|
|
165817
166695
|
|
|
165818
166696
|
// ../language-server/out/src/services/conformance.js
|
|
165819
|
-
var
|
|
166697
|
+
var SPECIALIZATION_KINDS5 = /* @__PURE__ */ new Set([
|
|
165820
166698
|
":>",
|
|
165821
166699
|
":>>",
|
|
165822
166700
|
"specializes",
|
|
@@ -165848,7 +166726,7 @@ function specializedNamesOf(node) {
|
|
|
165848
166726
|
const decl = node;
|
|
165849
166727
|
const out = [];
|
|
165850
166728
|
for (const rel2 of [...decl.preRelationships ?? [], ...decl.relationships ?? []]) {
|
|
165851
|
-
if (!rel2.kind || !
|
|
166729
|
+
if (!rel2.kind || !SPECIALIZATION_KINDS5.has(rel2.kind))
|
|
165852
166730
|
continue;
|
|
165853
166731
|
for (const target of rel2.targets ?? []) {
|
|
165854
166732
|
const text = target.trim();
|
|
@@ -166499,7 +167377,7 @@ function candidatesOf(node) {
|
|
|
166499
167377
|
continue;
|
|
166500
167378
|
out.push({ text: written.text, ref: written.ref });
|
|
166501
167379
|
}
|
|
166502
|
-
for (const target of
|
|
167380
|
+
for (const target of specializationTargetsOf3(node))
|
|
166503
167381
|
out.push({ text: target });
|
|
166504
167382
|
return out;
|
|
166505
167383
|
}
|
|
@@ -166523,7 +167401,7 @@ function owningOccurrenceOf(node) {
|
|
|
166523
167401
|
return NON_OCCURRENCE_DECL_TYPES.has(owner.$type) ? void 0 : owner;
|
|
166524
167402
|
}
|
|
166525
167403
|
var MAX_ALIAS_HOPS = 8;
|
|
166526
|
-
var
|
|
167404
|
+
var SPECIALIZATION_KINDS6 = /* @__PURE__ */ new Set([
|
|
166527
167405
|
":>",
|
|
166528
167406
|
"subsets",
|
|
166529
167407
|
":>>",
|
|
@@ -166531,11 +167409,11 @@ var SPECIALIZATION_KINDS4 = /* @__PURE__ */ new Set([
|
|
|
166531
167409
|
"specializes",
|
|
166532
167410
|
"subtype"
|
|
166533
167411
|
]);
|
|
166534
|
-
function
|
|
167412
|
+
function specializationTargetsOf3(node) {
|
|
166535
167413
|
const decl = node;
|
|
166536
167414
|
const out = [];
|
|
166537
167415
|
for (const rel2 of [...decl.preRelationships ?? [], ...decl.relationships ?? []]) {
|
|
166538
|
-
if (!rel2.kind || !
|
|
167416
|
+
if (!rel2.kind || !SPECIALIZATION_KINDS6.has(rel2.kind))
|
|
166539
167417
|
continue;
|
|
166540
167418
|
for (const target of rel2.targets ?? []) {
|
|
166541
167419
|
const text = target.trim();
|
|
@@ -166742,7 +167620,7 @@ function isAstDescendantOrSelf(node, ancestor) {
|
|
|
166742
167620
|
return false;
|
|
166743
167621
|
}
|
|
166744
167622
|
function ivEditMeta(part, instanceId, definition, localUsage, localPath, uri) {
|
|
166745
|
-
const declarationId =
|
|
167623
|
+
const declarationId = nameOf3(part) ? qnameOf(part) || instanceId : instanceId;
|
|
166746
167624
|
const definitionId = definition ? qnameOf(definition) : void 0;
|
|
166747
167625
|
const localUsageId = localUsage ? qnameOf(localUsage) : void 0;
|
|
166748
167626
|
return {
|
|
@@ -166751,19 +167629,19 @@ function ivEditMeta(part, instanceId, definition, localUsage, localPath, uri) {
|
|
|
166751
167629
|
declarationName: effectiveNameOf(part),
|
|
166752
167630
|
declarationSource: sourceOf2(part, uri),
|
|
166753
167631
|
definitionId,
|
|
166754
|
-
definitionName: definition ?
|
|
167632
|
+
definitionName: definition ? nameOf3(definition) : void 0,
|
|
166755
167633
|
definitionSource: definition ? sourceOf2(definition, uri) : void 0,
|
|
166756
167634
|
localUsageId,
|
|
166757
|
-
localUsageName: localUsage ?
|
|
167635
|
+
localUsageName: localUsage ? nameOf3(localUsage) : void 0,
|
|
166758
167636
|
localUsageSource: localUsage ? sourceOf2(localUsage, uri) : void 0,
|
|
166759
167637
|
localUsagePath: [...localPath],
|
|
166760
167638
|
expandedFromDefinition: declarationId !== instanceId,
|
|
166761
167639
|
// A named declaration remains local even when an anonymous `:>>`
|
|
166762
167640
|
// wrapper removes its name from the rendered occurrence path.
|
|
166763
|
-
localDeclaration: !!
|
|
167641
|
+
localDeclaration: !!nameOf3(part) && !!localUsage && isAstDescendantOrSelf(part, localUsage)
|
|
166764
167642
|
};
|
|
166765
167643
|
}
|
|
166766
|
-
var
|
|
167644
|
+
var nameOf3 = (node) => {
|
|
166767
167645
|
const external = externalVariantName(node);
|
|
166768
167646
|
if (external)
|
|
166769
167647
|
return external;
|
|
@@ -166792,7 +167670,7 @@ function qnameOf(node) {
|
|
|
166792
167670
|
const parts = [];
|
|
166793
167671
|
let cur = node;
|
|
166794
167672
|
while (cur && !isDocument(cur)) {
|
|
166795
|
-
const nm =
|
|
167673
|
+
const nm = nameOf3(cur);
|
|
166796
167674
|
if (nm)
|
|
166797
167675
|
parts.unshift(nm);
|
|
166798
167676
|
cur = cur.$container;
|
|
@@ -166914,7 +167792,7 @@ function declaredConnectionEndNotation(node) {
|
|
|
166914
167792
|
}
|
|
166915
167793
|
}
|
|
166916
167794
|
return mergeConnectionEndNotation({
|
|
166917
|
-
role: n2.innerName ??
|
|
167795
|
+
role: n2.innerName ?? nameOf3(node) ?? redefines.map(lastSeg).find(Boolean),
|
|
166918
167796
|
multiplicity: connectionEndMultiplicity(node),
|
|
166919
167797
|
direction,
|
|
166920
167798
|
properties,
|
|
@@ -166944,9 +167822,9 @@ var prefixTagsOf = (node) => {
|
|
|
166944
167822
|
return [...own, ...wrap2].map((t) => t.type?.$refText).filter((s) => !!s);
|
|
166945
167823
|
};
|
|
166946
167824
|
var metadataAttrsText = (node) => {
|
|
166947
|
-
const pairs = membersOf(node).filter((m) => m.$type === "EnumValueDecl" &&
|
|
167825
|
+
const pairs = membersOf(node).filter((m) => m.$type === "EnumValueDecl" && nameOf3(m) && m.value).map((m) => {
|
|
166948
167826
|
const value = m.value.$cstNode?.text ?? "";
|
|
166949
|
-
return `${
|
|
167827
|
+
return `${nameOf3(m)} = ${value}`.replace(/\s+/g, " ").trim();
|
|
166950
167828
|
});
|
|
166951
167829
|
return pairs.length ? pairs.join(", ") : void 0;
|
|
166952
167830
|
};
|
|
@@ -166967,10 +167845,24 @@ function parameterKeyword(node) {
|
|
|
166967
167845
|
}
|
|
166968
167846
|
return owner && (isConstraintDecl(owner) || isCalcDecl(owner)) ? `${direction} parameter` : void 0;
|
|
166969
167847
|
}
|
|
167848
|
+
var effectiveSemanticKinds = /* @__PURE__ */ new WeakMap();
|
|
167849
|
+
var isEffectivePartDecl = (node) => isPartDecl(node) || effectiveDeclTypeOf(node) === "PartDecl";
|
|
167850
|
+
function semanticKeywordOf(node) {
|
|
167851
|
+
if (!isKeywordlessDeclaration(node))
|
|
167852
|
+
return void 0;
|
|
167853
|
+
const kind = effectiveSemanticKinds.get(node);
|
|
167854
|
+
return kind ? effectiveKeywordOf(kind) : void 0;
|
|
167855
|
+
}
|
|
167856
|
+
function effectiveDeclTypeOf(node) {
|
|
167857
|
+
return effectiveSemanticKinds.get(node)?.declType ?? node.$type;
|
|
167858
|
+
}
|
|
166970
167859
|
function keywordFor(node) {
|
|
166971
167860
|
const n2 = node;
|
|
166972
167861
|
if (node.$type === "VariantReference")
|
|
166973
167862
|
return "variant";
|
|
167863
|
+
const semantic = semanticKeywordOf(node);
|
|
167864
|
+
if (semantic)
|
|
167865
|
+
return semantic;
|
|
166974
167866
|
const def = n2.isDef === true;
|
|
166975
167867
|
const t = node.$type;
|
|
166976
167868
|
const base = {
|
|
@@ -167092,7 +167984,7 @@ var ANONYMOUS_INTERFACE_NAME = "(anonymous)";
|
|
|
167092
167984
|
var isEndMember = (node) => node.$type === "EndDecl" || modifiersOf2(node).includes("end");
|
|
167093
167985
|
function endRowText(node) {
|
|
167094
167986
|
const end = node;
|
|
167095
|
-
const name =
|
|
167987
|
+
const name = nameOf3(node) ?? end.innerName;
|
|
167096
167988
|
const type = typeText(node) ?? end.innerTyping?.type?.$refText;
|
|
167097
167989
|
const mult = declaredMultText(node) ?? multiplicityText(end.innerMultiplicity) ?? multiplicityText(end.endMultiplicity);
|
|
167098
167990
|
const head2 = `${name ?? ""}${type ? `${name ? " " : ""}: ${type}` : ""}`.trim();
|
|
@@ -167122,14 +168014,14 @@ var individualMetaOf = (node) => {
|
|
|
167122
168014
|
}
|
|
167123
168015
|
};
|
|
167124
168016
|
};
|
|
167125
|
-
var
|
|
168017
|
+
var redefinedNameOf2 = (node) => {
|
|
167126
168018
|
const names = effectiveNamesOf(node, localResolverFor(node));
|
|
167127
168019
|
return names.origin === "derived" || names.origin === "written" ? names.name ?? names.shortName : void 0;
|
|
167128
168020
|
};
|
|
167129
|
-
var effectiveNameOf = (node) =>
|
|
168021
|
+
var effectiveNameOf = (node) => nameOf3(node) ?? redefinedNameOf2(node);
|
|
167130
168022
|
var portionLabelOf = (node) => effectiveNameOf(node);
|
|
167131
168023
|
function diagramNodeId(node) {
|
|
167132
|
-
const name =
|
|
168024
|
+
const name = nameOf3(node);
|
|
167133
168025
|
if (name)
|
|
167134
168026
|
return qnameOf(node) || name;
|
|
167135
168027
|
const label = portionLabelOf(node);
|
|
@@ -167153,10 +168045,10 @@ var GV_EXPLICIT_USAGE_KINDS = /* @__PURE__ */ new Set([
|
|
|
167153
168045
|
"VariantReference"
|
|
167154
168046
|
]);
|
|
167155
168047
|
function isGvAnnotationNode(node) {
|
|
167156
|
-
return ["CommentStmt", "RepStmt", "DocCommentMember", "MetadataAnnotation"].includes(node.$type) || isMetadataDecl(node) && !isDefinitionNode(node) && !!(
|
|
168048
|
+
return ["CommentStmt", "RepStmt", "DocCommentMember", "MetadataAnnotation"].includes(node.$type) || isMetadataDecl(node) && !isDefinitionNode(node) && !!(nameOf3(node) || typeText(node));
|
|
167157
168049
|
}
|
|
167158
168050
|
function isGvExplicitUsage(node) {
|
|
167159
|
-
return !isDefinitionNode(node) && !isGvAnnotationNode(node) && !(node.$type === "PerformStmt" && node.actionKw !== true) && !(isInterfaceDecl(node) && node.target !== void 0 && node.connect === void 0) && !!(effectiveNameOf(node) ??
|
|
168051
|
+
return !isDefinitionNode(node) && !isGvAnnotationNode(node) && !(node.$type === "PerformStmt" && node.actionKw !== true) && !(isInterfaceDecl(node) && node.target !== void 0 && node.connect === void 0) && !!(effectiveNameOf(node) ?? nameOf3(node)) && (isDefinitionKind(node) || isDeclaredEventOccurrence(node) || GV_EXPLICIT_USAGE_KINDS.has(node.$type) || isActionFlowStep(node));
|
|
167160
168052
|
}
|
|
167161
168053
|
function specializationTargets(node) {
|
|
167162
168054
|
const n2 = node;
|
|
@@ -167342,10 +168234,11 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167342
168234
|
notes: [note]
|
|
167343
168235
|
});
|
|
167344
168236
|
const index2 = this.localIndex(root4);
|
|
168237
|
+
const semantic = this.primeSemanticKeywords(root4);
|
|
167345
168238
|
const anchor = !rootSymbol && preferFileOverview ? this.fileOverviewAnchor(root4) : this.findAnchor(root4, rootSymbol, kind, index2);
|
|
167346
168239
|
if (!anchor)
|
|
167347
168240
|
return empty2(`No anchor element found for the ${kind.toUpperCase()} view.`);
|
|
167348
|
-
const ctx = { uri, index: index2, anchor, diagramRoot: anchor, gridPreset, matrixRelationship };
|
|
168241
|
+
const ctx = { uri, index: index2, anchor, diagramRoot: anchor, gridPreset, matrixRelationship, semantic };
|
|
167349
168242
|
const overview = isPackage(anchor) || isDocument(anchor);
|
|
167350
168243
|
const build = () => {
|
|
167351
168244
|
switch (kind) {
|
|
@@ -167553,7 +168446,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167553
168446
|
hasAnyGridContent(anchor) {
|
|
167554
168447
|
const scope = this.packageScopeOf(anchor);
|
|
167555
168448
|
for (const node of ast_utils_exports.streamAllContents(scope)) {
|
|
167556
|
-
if (isDefinitionKind(node) &&
|
|
168449
|
+
if (isDefinitionKind(node) && nameOf3(node))
|
|
167557
168450
|
return true;
|
|
167558
168451
|
const n2 = node;
|
|
167559
168452
|
if (node.$type === "AllocateStmt" || node.$type === "DependencyDecl" || node.$type === "SatisfyStmt" || node.$type === "FlowStmt" && n2.flowKind !== "message" || node.$type === "ConnectStmt" || node.$type === "ConnectionDecl" && n2.isDef !== true && n2.connect !== void 0)
|
|
@@ -167574,7 +168467,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167574
168467
|
for (const node of [root4, ...this.rootContents(root4)]) {
|
|
167575
168468
|
if (node.$type === "ImportSeg")
|
|
167576
168469
|
continue;
|
|
167577
|
-
const nm =
|
|
168470
|
+
const nm = nameOf3(node);
|
|
167578
168471
|
if (nm && !map3.has(nm))
|
|
167579
168472
|
map3.set(nm, node);
|
|
167580
168473
|
}
|
|
@@ -167630,7 +168523,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167630
168523
|
annotation: comment,
|
|
167631
168524
|
owner,
|
|
167632
168525
|
keyword: "comment",
|
|
167633
|
-
label:
|
|
168526
|
+
label: nameOf3(comment) ?? "comment",
|
|
167634
168527
|
body: annotationText(trailingBlockBody(comment))
|
|
167635
168528
|
});
|
|
167636
168529
|
}
|
|
@@ -167642,7 +168535,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167642
168535
|
annotation: doc,
|
|
167643
168536
|
owner: doc.$container,
|
|
167644
168537
|
keyword: "doc",
|
|
167645
|
-
label:
|
|
168538
|
+
label: nameOf3(doc) ?? "doc",
|
|
167646
168539
|
body: annotationText(docCommentBody(doc))
|
|
167647
168540
|
});
|
|
167648
168541
|
}
|
|
@@ -167685,6 +168578,38 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167685
168578
|
return void 0;
|
|
167686
168579
|
return multiplicity2.text;
|
|
167687
168580
|
}
|
|
168581
|
+
/**
|
|
168582
|
+
* issue #293 — read the document's user-defined keywords once, and record
|
|
168583
|
+
* the effective kind each one gives a keywordless declaration.
|
|
168584
|
+
*
|
|
168585
|
+
* Called before anything projects the AST, so `keywordFor` and the kind
|
|
168586
|
+
* tests see the model rather than the parse. The result is cached per parse
|
|
168587
|
+
* AND per workspace-index epoch, because a `baseType` may name an element in
|
|
168588
|
+
* another file whose resolution changes as the index fills.
|
|
168589
|
+
*/
|
|
168590
|
+
// REQ-420 — SemanticMetadata and user-defined keyword specialization
|
|
168591
|
+
primeSemanticKeywords(root4) {
|
|
168592
|
+
const cache = this.perParse(root4);
|
|
168593
|
+
if (cache.semanticKeywords?.epoch === this.indexEpoch)
|
|
168594
|
+
return cache.semanticKeywords.model;
|
|
168595
|
+
const paths = this.annotationPathResolver(root4);
|
|
168596
|
+
const lookup = this.shared ? nameLookupFor(this.shared) : void 0;
|
|
168597
|
+
const model = new SemanticMetadataModel(metadataNameResolver({
|
|
168598
|
+
visibleCandidates: (from, name) => paths.resolveVisibleNameCandidates(from, name),
|
|
168599
|
+
descriptionsFor: (name) => lookup?.descriptions(name) ?? [],
|
|
168600
|
+
nodeFor: (description) => this.annotationDescriptionNode(root4, description)
|
|
168601
|
+
}), (usage, _text, occurrence) => {
|
|
168602
|
+
const candidates = paths.resolvePropertyPathCandidates(usage, "targets", occurrence);
|
|
168603
|
+
return candidates.length === 1 ? candidates[0] : void 0;
|
|
168604
|
+
}).build(root4);
|
|
168605
|
+
for (const element of model.annotatedElements()) {
|
|
168606
|
+
const kind = effectiveKindOf(element, model.annotationsOf(element));
|
|
168607
|
+
if (kind)
|
|
168608
|
+
effectiveSemanticKinds.set(element, kind);
|
|
168609
|
+
}
|
|
168610
|
+
cache.semanticKeywords = { epoch: this.indexEpoch, model };
|
|
168611
|
+
return model;
|
|
168612
|
+
}
|
|
167688
168613
|
annotationDescriptionNode(context, description) {
|
|
167689
168614
|
if (!description)
|
|
167690
168615
|
return void 0;
|
|
@@ -167718,12 +168643,12 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167718
168643
|
const unrooted = path10.replace(/^\s*\$\s*::\s*/u, "");
|
|
167719
168644
|
if (!/::|\./u.test(unrooted)) {
|
|
167720
168645
|
for (let scope = comment.$container; scope; scope = scope.$container) {
|
|
167721
|
-
const local = membersOf(scope).find((member) => member !== comment &&
|
|
168646
|
+
const local = membersOf(scope).find((member) => member !== comment && nameOf3(member) === unrooted);
|
|
167722
168647
|
if (local)
|
|
167723
168648
|
return local;
|
|
167724
168649
|
const declaringIndex = this.localIndex(this.documentRootOf(scope));
|
|
167725
168650
|
for (const inherited of this.inheritedFeatureOwnersOf(scope, declaringIndex)) {
|
|
167726
|
-
const inheritedMember = membersOf(inherited).find((member) =>
|
|
168651
|
+
const inheritedMember = membersOf(inherited).find((member) => nameOf3(member) === unrooted);
|
|
167727
168652
|
if (inheritedMember)
|
|
167728
168653
|
return inheritedMember;
|
|
167729
168654
|
}
|
|
@@ -167847,7 +168772,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167847
168772
|
* in definition-sync mode address this feature, while child insertion still
|
|
167848
168773
|
* addresses the feature's typing definition. */
|
|
167849
168774
|
synchronizationDeclarationOf(node, index2) {
|
|
167850
|
-
if (
|
|
168775
|
+
if (nameOf3(node))
|
|
167851
168776
|
return node;
|
|
167852
168777
|
const wanted = effectiveNameOf(node);
|
|
167853
168778
|
return this.inheritedFeatureOwnersOf(node, index2).find((candidate) => candidate.isDef !== true && effectiveNameOf(candidate) === wanted && (isPartDecl(node) ? isPartDecl(candidate) : isPortDecl(node) ? isPortDecl(candidate) : true));
|
|
@@ -167939,7 +168864,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
167939
168864
|
return this.hasAnchorContent(root4, "bv", index2) ? root4 : void 0;
|
|
167940
168865
|
}
|
|
167941
168866
|
if (rootSymbol) {
|
|
167942
|
-
const resolved = all.find((n2) => n2.$type !== "ImportSeg" &&
|
|
168867
|
+
const resolved = all.find((n2) => n2.$type !== "ImportSeg" && nameOf3(n2) !== void 0 && qnameOf(n2) === rootSymbol) ?? index2.get(rootSymbol) ?? index2.get(lastSeg(rootSymbol));
|
|
167943
168868
|
if (resolved) {
|
|
167944
168869
|
if (kind === "bv")
|
|
167945
168870
|
return resolved;
|
|
@@ -168007,7 +168932,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168007
168932
|
// the no-rootSymbol fallback still prefers a contentful anchor.
|
|
168008
168933
|
canHostView(node, kind) {
|
|
168009
168934
|
if (kind === "iv")
|
|
168010
|
-
return
|
|
168935
|
+
return isEffectivePartDecl(node) && node.isDef !== true;
|
|
168011
168936
|
if (kind === "gev")
|
|
168012
168937
|
return isPartDecl(node) || isPackage(node) || isDocument(node);
|
|
168013
168938
|
return false;
|
|
@@ -168027,7 +168952,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168027
168952
|
case "gv":
|
|
168028
168953
|
return true;
|
|
168029
168954
|
case "iv":
|
|
168030
|
-
return
|
|
168955
|
+
return isEffectivePartDecl(node);
|
|
168031
168956
|
case "afv":
|
|
168032
168957
|
return isActionDecl(node) || isCalcDecl(node) || isPartDecl(node) || this.isCaseLike(node);
|
|
168033
168958
|
case "stv":
|
|
@@ -168052,7 +168977,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168052
168977
|
// and `findAnchor` drills to them, so a view opened on the OWNER of an empty
|
|
168053
168978
|
// action definition shows the same thing the package overview does.
|
|
168054
168979
|
isAfvScaffoldAnchor(node) {
|
|
168055
|
-
return (isActionDecl(node) || isCalcDecl(node)) && !!
|
|
168980
|
+
return (isActionDecl(node) || isCalcDecl(node)) && !!nameOf3(node) && (node.isDef === true || this.isDirectPackageMember(node));
|
|
168056
168981
|
}
|
|
168057
168982
|
// REQ-196 — a member that is a STEP of the flow its holder runs: an action
|
|
168058
168983
|
// usage, a send/accept/assign node, or a `perform`. An action DEFINITION is
|
|
@@ -168159,13 +169084,13 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168159
169084
|
return own;
|
|
168160
169085
|
};
|
|
168161
169086
|
const memberNamed3 = (holder, seg) => {
|
|
168162
|
-
const own = pathVisibleMembers(holder).find((m) =>
|
|
169087
|
+
const own = pathVisibleMembers(holder).find((m) => nameOf3(m) === seg);
|
|
168163
169088
|
if (own)
|
|
168164
169089
|
return own;
|
|
168165
169090
|
const def = holder.isDef === true ? void 0 : this.resolveType(holder, index2);
|
|
168166
169091
|
if (!def || def === holder)
|
|
168167
169092
|
return void 0;
|
|
168168
|
-
return pathVisibleMembers(def).find((m) =>
|
|
169093
|
+
return pathVisibleMembers(def).find((m) => nameOf3(m) === seg);
|
|
168169
169094
|
};
|
|
168170
169095
|
let cur;
|
|
168171
169096
|
for (let owner = stmt.$container; owner && !cur; owner = owner.$container) {
|
|
@@ -168173,7 +169098,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168173
169098
|
}
|
|
168174
169099
|
if (!cur) {
|
|
168175
169100
|
const indexed = index2.get(segs[0]);
|
|
168176
|
-
cur = indexed && declares(indexed) ? indexed : this.rootContents(this.documentRootOf(stmt)).find((n2) => declares(n2) &&
|
|
169101
|
+
cur = indexed && declares(indexed) ? indexed : this.rootContents(this.documentRootOf(stmt)).find((n2) => declares(n2) && nameOf3(n2) === segs[0]);
|
|
168177
169102
|
}
|
|
168178
169103
|
for (const seg of segs.slice(1)) {
|
|
168179
169104
|
if (!cur)
|
|
@@ -168240,7 +169165,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168240
169165
|
...paramType && !repeatedType ? membersOf(paramType) : []
|
|
168241
169166
|
];
|
|
168242
169167
|
for (const inner of sources) {
|
|
168243
|
-
const nn =
|
|
169168
|
+
const nn = nameOf3(inner);
|
|
168244
169169
|
if (!nn || !directionOf(inner) || seen.has(nn))
|
|
168245
169170
|
continue;
|
|
168246
169171
|
seen.add(nn);
|
|
@@ -168258,7 +169183,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168258
169183
|
const result = effectiveCalculationResult(action, (name) => index2.get(name));
|
|
168259
169184
|
if (result) {
|
|
168260
169185
|
const parameter = result.parameter;
|
|
168261
|
-
const name = parameter ?
|
|
169186
|
+
const name = parameter ? nameOf3(parameter) ?? "result" : "result";
|
|
168262
169187
|
pins.push({
|
|
168263
169188
|
id: `${ownerId}.${name}`,
|
|
168264
169189
|
name,
|
|
@@ -168296,16 +169221,16 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168296
169221
|
if (node.isDef === true)
|
|
168297
169222
|
continue;
|
|
168298
169223
|
const def = this.resolveType(node, index2);
|
|
168299
|
-
if (!def || def.isDef !== true || !
|
|
169224
|
+
if (!def || def.isDef !== true || !nameOf3(def) || def === node)
|
|
168300
169225
|
continue;
|
|
168301
169226
|
if (!ownedByDiagramRoot(def, root4))
|
|
168302
169227
|
continue;
|
|
168303
169228
|
if (!seen.has(def)) {
|
|
168304
|
-
const defId = qnameOf(def) ||
|
|
169229
|
+
const defId = qnameOf(def) || nameOf3(def);
|
|
168305
169230
|
if (!drawnIds.has(defId)) {
|
|
168306
169231
|
nodes.push({
|
|
168307
169232
|
id: defId,
|
|
168308
|
-
name:
|
|
169233
|
+
name: nameOf3(def),
|
|
168309
169234
|
keyword: keywordFor(def),
|
|
168310
169235
|
isDef: true,
|
|
168311
169236
|
shape,
|
|
@@ -168390,19 +169315,19 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168390
169315
|
return true;
|
|
168391
169316
|
if (!isPackage(node) && !isDocument(node))
|
|
168392
169317
|
return false;
|
|
168393
|
-
return ast_utils_exports.streamAllContents(node).some((member) => isDefinitionNode(member) && !!
|
|
169318
|
+
return ast_utils_exports.streamAllContents(node).some((member) => isDefinitionNode(member) && !!nameOf3(member) || isGvExplicitUsage(member) || isGvAnnotationNode(member) || isPackage(member) && !!nameOf3(member));
|
|
168394
169319
|
}
|
|
168395
169320
|
case "iv":
|
|
168396
169321
|
if (isPartDecl(node)) {
|
|
168397
169322
|
return this.hasNestedPartUsages(node, index2) || this.hasRenderablePorts(node, index2);
|
|
168398
169323
|
}
|
|
168399
|
-
return (isPackage(node) || isDocument(node)) && this.nestedUsages(node, isPartDecl).some((n2) =>
|
|
169324
|
+
return (isPackage(node) || isDocument(node)) && this.nestedUsages(node, isPartDecl).some((n2) => nameOf3(n2) !== void 0);
|
|
168400
169325
|
case "afv": {
|
|
168401
169326
|
if (isCalcDecl(node))
|
|
168402
169327
|
return true;
|
|
168403
169328
|
if (isActionDecl(node) || this.isCaseLike(node)) {
|
|
168404
169329
|
const actions = membersOf(node).map((member) => this.thenActionMemberNode(member) ?? member).filter((n2) => isActionDecl(n2) || isCalcDecl(n2));
|
|
168405
|
-
if (actions.some((n2) =>
|
|
169330
|
+
if (actions.some((n2) => nameOf3(n2) !== void 0))
|
|
168406
169331
|
return true;
|
|
168407
169332
|
return node.inlineBody !== void 0;
|
|
168408
169333
|
}
|
|
@@ -168415,15 +169340,15 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168415
169340
|
case "stv":
|
|
168416
169341
|
if (!(isExhibitStateDecl(node) || isStateDecl(node)))
|
|
168417
169342
|
return false;
|
|
168418
|
-
if (membersOf(node).some((n2) => isStateDecl(n2) &&
|
|
169343
|
+
if (membersOf(node).some((n2) => isStateDecl(n2) && nameOf3(n2) !== void 0))
|
|
168419
169344
|
return true;
|
|
168420
169345
|
const stateDef = node.isDef !== true ? this.resolveType(node, index2) : void 0;
|
|
168421
|
-
return !!stateDef && stateDef !== node && membersOf(stateDef).some((n2) => isStateDecl(n2) &&
|
|
169346
|
+
return !!stateDef && stateDef !== node && membersOf(stateDef).some((n2) => isStateDecl(n2) && nameOf3(n2) !== void 0);
|
|
168422
169347
|
// REQ-202 — a focused Sequence View may be opened as a participant
|
|
168423
169348
|
// scaffold before messages are added; package tiling applies the
|
|
168424
169349
|
// stricter interaction filter in collectOverviewAnchors.
|
|
168425
169350
|
case "sv":
|
|
168426
|
-
return (isPartDecl(node) || isOccurrenceDecl(node) || this.isCaseLike(node) || isPackage(node)) && this.nestedUsages(node, isPartDecl).some((n2) =>
|
|
169351
|
+
return (isPartDecl(node) || isOccurrenceDecl(node) || this.isCaseLike(node) || isPackage(node)) && this.nestedUsages(node, isPartDecl).some((n2) => nameOf3(n2) !== void 0);
|
|
168427
169352
|
case "cv": {
|
|
168428
169353
|
if (!(this.isCaseLike(node) || isPackage(node) || isDocument(node)))
|
|
168429
169354
|
return false;
|
|
@@ -168438,7 +169363,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168438
169363
|
return this.hasAnyGridContent(node);
|
|
168439
169364
|
}
|
|
168440
169365
|
case "bv":
|
|
168441
|
-
return (isPackage(node) || isDocument(node)) && [...ast_utils_exports.streamAllContents(node)].some((n2) =>
|
|
169366
|
+
return (isPackage(node) || isDocument(node)) && [...ast_utils_exports.streamAllContents(node)].some((n2) => nameOf3(n2) !== void 0);
|
|
168442
169367
|
}
|
|
168443
169368
|
}
|
|
168444
169369
|
// REQ-205 — the Geometry View shows ONLY geometry objects, so a node anchors
|
|
@@ -168477,7 +169402,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168477
169402
|
// The predicate form of `childUsagesOf`, so an anchor that only INHERITS
|
|
168478
169403
|
// internals is recognised as having them.
|
|
168479
169404
|
hasNestedPartUsages(node, index2) {
|
|
168480
|
-
return this.structuralChildUsagesOf(node, index2).some((usage) =>
|
|
169405
|
+
return this.structuralChildUsagesOf(node, index2).some((usage) => nameOf3(usage) !== void 0);
|
|
168481
169406
|
}
|
|
168482
169407
|
nestedUsages(node, guard) {
|
|
168483
169408
|
return membersOf(node).filter((m) => guard(m) && m.isDef !== true);
|
|
@@ -168505,10 +169430,10 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168505
169430
|
* fold used for other effective inventories. Authored subsets of an inherited
|
|
168506
169431
|
* library collection stay visible; only the inherited recursive role is hidden. */
|
|
168507
169432
|
structuralChildUsagesOf(part, index2) {
|
|
168508
|
-
const out = this.nestedUsages(part,
|
|
169433
|
+
const out = this.nestedUsages(part, isEffectivePartDecl);
|
|
168509
169434
|
const have = new Set(out.map(effectiveNameOf).filter((name) => !!name));
|
|
168510
169435
|
for (const source of this.inheritedFeatureOwnersOf(part, index2)) {
|
|
168511
|
-
for (const usage of this.nestedUsages(source,
|
|
169436
|
+
for (const usage of this.nestedUsages(source, isEffectivePartDecl)) {
|
|
168512
169437
|
if (this.isInheritedLibraryBackboneFeature(source, usage, index2))
|
|
168513
169438
|
continue;
|
|
168514
169439
|
const name = effectiveNameOf(usage);
|
|
@@ -168566,13 +169491,13 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168566
169491
|
node,
|
|
168567
169492
|
this.resolveType(node, index2) ?? this.effectiveEnumerationType(node) ?? (featureInheritanceTargets(node).length ? this.inheritedFeatureOwnersOf(node, index2).find(isDefinitionNode) : void 0)
|
|
168568
169493
|
]));
|
|
168569
|
-
const defNodes = all.filter((n2) => isDefinitionNode(n2) &&
|
|
169494
|
+
const defNodes = all.filter((n2) => isDefinitionNode(n2) && nameOf3(n2));
|
|
168570
169495
|
const packageOverview = isPackage(ctx.anchor) || isDocument(ctx.anchor);
|
|
168571
169496
|
const isDirectPackageInterfaceUsage = (n2) => isInterfaceDecl(n2) && n2.isDef !== true && this.isDirectPackageMember(n2);
|
|
168572
|
-
const hasOwnedMemberNode = defNodes.length > 0 || usageNodes.length > 0 || annotationNodes.length > 0 || all.some((n2) => isPackage(n2) && !!
|
|
169497
|
+
const hasOwnedMemberNode = defNodes.length > 0 || usageNodes.length > 0 || annotationNodes.length > 0 || all.some((n2) => isPackage(n2) && !!nameOf3(n2) || isDirectPackageInterfaceUsage(n2));
|
|
168573
169498
|
const packageNodes = [
|
|
168574
|
-
...packageOverview && hasOwnedMemberNode && isPackage(scope) &&
|
|
168575
|
-
...all.filter((p) => isPackage(p) &&
|
|
169499
|
+
...packageOverview && hasOwnedMemberNode && isPackage(scope) && nameOf3(scope) ? [scope] : [],
|
|
169500
|
+
...all.filter((p) => isPackage(p) && nameOf3(p))
|
|
168576
169501
|
];
|
|
168577
169502
|
const semanticNodes = /* @__PURE__ */ new Set([...packageNodes, ...defNodes, ...usageNodes, ...annotationNodes]);
|
|
168578
169503
|
const semanticOwners = /* @__PURE__ */ new Map();
|
|
@@ -168600,20 +169525,23 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168600
169525
|
};
|
|
168601
169526
|
const readsAsAttribute = (node) => isAttributeDecl(node) || isAttributeDecl(this.resolveType(node, index2));
|
|
168602
169527
|
const implicitlyRedefined = (node) => {
|
|
168603
|
-
const name =
|
|
169528
|
+
const name = nameOf3(node);
|
|
168604
169529
|
const owner = semanticOwner(node);
|
|
168605
169530
|
if (!name || !owner || owner.isDef === true)
|
|
168606
169531
|
return void 0;
|
|
168607
169532
|
const definition = usageDefinitions.get(owner);
|
|
168608
169533
|
if (!definition)
|
|
168609
169534
|
return void 0;
|
|
168610
|
-
return membersOf(definition).find((member) =>
|
|
169535
|
+
return membersOf(definition).find((member) => nameOf3(member) === name);
|
|
168611
169536
|
};
|
|
168612
169537
|
const attributeUsages = new Set(usageNodes.filter((node) => {
|
|
168613
169538
|
if (isDefinitionParameter(node))
|
|
168614
169539
|
return false;
|
|
168615
169540
|
if (isAttributeDecl(node))
|
|
168616
169541
|
return true;
|
|
169542
|
+
const effective = effectiveDeclTypeOf(node);
|
|
169543
|
+
if (effective !== node.$type)
|
|
169544
|
+
return effective === "AttributeDecl";
|
|
168617
169545
|
const owner = semanticOwner(node);
|
|
168618
169546
|
if (node.$type === "EnumValueDecl")
|
|
168619
169547
|
return !!owner && !isEnumDecl(owner);
|
|
@@ -168657,7 +169585,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168657
169585
|
let ownerId = current2 ? ids.get(current2) ?? "" : "";
|
|
168658
169586
|
for (let i = lineage.length - 1; i >= 0; i--) {
|
|
168659
169587
|
const { member, owner } = lineage[i];
|
|
168660
|
-
let segment = effectiveNameOf(member) ??
|
|
169588
|
+
let segment = effectiveNameOf(member) ?? nameOf3(member) ?? (member.$type === "MetadataAnnotation" ? member.declName : void 0);
|
|
168661
169589
|
if (!segment && !isDocument(member)) {
|
|
168662
169590
|
const counts = unnamedOrdinals.get(owner ?? member) ?? /* @__PURE__ */ new Map();
|
|
168663
169591
|
unnamedOrdinals.set(owner ?? member, counts);
|
|
@@ -168686,13 +169614,13 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168686
169614
|
emitted.add(n2);
|
|
168687
169615
|
nodes.push({
|
|
168688
169616
|
id: id2,
|
|
168689
|
-
name: effectiveNameOf(n2) ??
|
|
169617
|
+
name: effectiveNameOf(n2) ?? nameOf3(n2),
|
|
168690
169618
|
keyword: keywordFor(n2),
|
|
168691
169619
|
isDef,
|
|
168692
169620
|
shape,
|
|
168693
169621
|
abstract: isAbstract(n2) || void 0,
|
|
168694
169622
|
multiplicity: this.multText(n2),
|
|
168695
|
-
type: typeText(n2) ?? (usageDefinitions.get(n2) ?
|
|
169623
|
+
type: typeText(n2) ?? (usageDefinitions.get(n2) ? nameOf3(usageDefinitions.get(n2)) : void 0),
|
|
168696
169624
|
...attributeUsages.has(n2) ? { value: attributeValue(n2) } : {},
|
|
168697
169625
|
// REQ-208/209 — the constraint or calculation expression field.
|
|
168698
169626
|
...showsExpressionField(n2) ? { value: expressionBody(n2) } : {},
|
|
@@ -168722,9 +169650,9 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168722
169650
|
if (!definition || !isConstraintDecl(definition))
|
|
168723
169651
|
continue;
|
|
168724
169652
|
const usageId = semanticId(usage);
|
|
168725
|
-
const local = new Set(membersOf(usage).flatMap((member) => [
|
|
169653
|
+
const local = new Set(membersOf(usage).flatMap((member) => [nameOf3(member), ...redefinitionTargetsOf(member)]).filter((name) => !!name));
|
|
168726
169654
|
for (const member of membersOf(definition)) {
|
|
168727
|
-
const name =
|
|
169655
|
+
const name = nameOf3(member);
|
|
168728
169656
|
if (!name || local.has(name))
|
|
168729
169657
|
continue;
|
|
168730
169658
|
if (directionOf(member) === void 0 && !isAttributeDecl(member))
|
|
@@ -168754,7 +169682,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168754
169682
|
// REQ-364 — the concrete usage that owns a local edit, plus
|
|
168755
169683
|
// the relative redefinition path to write inside it.
|
|
168756
169684
|
localUsageId: usageId,
|
|
168757
|
-
localUsageName:
|
|
169685
|
+
localUsageName: nameOf3(usage),
|
|
168758
169686
|
localUsageSource: sourceOf2(usage, uri),
|
|
168759
169687
|
localUsagePath: [name],
|
|
168760
169688
|
expandedFromDefinition: true,
|
|
@@ -168772,7 +169700,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168772
169700
|
}
|
|
168773
169701
|
const byName = /* @__PURE__ */ new Map();
|
|
168774
169702
|
for (const n2 of [...defNodes, ...usageNodes, ...packageNodes]) {
|
|
168775
|
-
const name = effectiveNameOf(n2) ??
|
|
169703
|
+
const name = effectiveNameOf(n2) ?? nameOf3(n2);
|
|
168776
169704
|
if (name && !byName.has(name))
|
|
168777
169705
|
byName.set(name, n2);
|
|
168778
169706
|
}
|
|
@@ -168820,7 +169748,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168820
169748
|
continue;
|
|
168821
169749
|
const node = nodes.find((nd) => nd.id === ids.get(target));
|
|
168822
169750
|
if (node)
|
|
168823
|
-
node.meta = { ...node.meta, alias:
|
|
169751
|
+
node.meta = { ...node.meta, alias: nameOf3(a2) };
|
|
168824
169752
|
}
|
|
168825
169753
|
const edges = [];
|
|
168826
169754
|
let e = 0;
|
|
@@ -168843,6 +169771,22 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168843
169771
|
});
|
|
168844
169772
|
}
|
|
168845
169773
|
}
|
|
169774
|
+
for (const annotation of ctx.semantic?.edgesOf(d) ?? []) {
|
|
169775
|
+
const base = annotation.base?.node;
|
|
169776
|
+
if (!base || !annotation.edge || !ids.has(base))
|
|
169777
|
+
continue;
|
|
169778
|
+
const tag = metadataTypeNamesOf(annotation.usage)[0];
|
|
169779
|
+
const subsets = annotation.edge.metaclass === "Subsetting" ? "{subsets}" : void 0;
|
|
169780
|
+
edges.push({
|
|
169781
|
+
id: `e${e++}`,
|
|
169782
|
+
from: ids.get(d),
|
|
169783
|
+
to: ids.get(base),
|
|
169784
|
+
kind: annotation.edge.metaclass === "FeatureTyping" ? "definedBy" : "specialization",
|
|
169785
|
+
label: [subsets, tag ? `\xAB${tag}\xBB` : void 0].filter(Boolean).join(" ") || void 0,
|
|
169786
|
+
meta: { impliedBySemanticMetadata: true, ...tag ? { semanticKeyword: tag } : {} },
|
|
169787
|
+
source: sourceOf2(d, uri)
|
|
169788
|
+
});
|
|
169789
|
+
}
|
|
168846
169790
|
}
|
|
168847
169791
|
for (const definition of defNodes.filter(isConnectionDecl)) {
|
|
168848
169792
|
const definitionId = ids.get(definition);
|
|
@@ -168869,9 +169813,9 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168869
169813
|
}
|
|
168870
169814
|
const common = {
|
|
168871
169815
|
kind: "connect",
|
|
168872
|
-
name:
|
|
169816
|
+
name: nameOf3(definition),
|
|
168873
169817
|
isDef: true,
|
|
168874
|
-
label: `\xABconnection def\xBB ${
|
|
169818
|
+
label: `\xABconnection def\xBB ${nameOf3(definition) ?? ""}`.trim(),
|
|
168875
169819
|
source: sourceOf2(definition, uri),
|
|
168876
169820
|
meta: { connectionDefinitionGraphical: true, connectionDefinitionId: definitionId },
|
|
168877
169821
|
...hasElaboration ? { elaboration: definitionId } : {}
|
|
@@ -168893,7 +169837,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168893
169837
|
const hubId = `${definitionId}::__connection__`;
|
|
168894
169838
|
nodes.push({
|
|
168895
169839
|
id: hubId,
|
|
168896
|
-
name:
|
|
169840
|
+
name: nameOf3(definition) ?? "",
|
|
168897
169841
|
keyword: "connection def",
|
|
168898
169842
|
isDef: true,
|
|
168899
169843
|
shape: "dot",
|
|
@@ -168996,7 +169940,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
168996
169940
|
from,
|
|
168997
169941
|
to,
|
|
168998
169942
|
kind: "reference",
|
|
168999
|
-
name:
|
|
169943
|
+
name: nameOf3(binding.ref),
|
|
169000
169944
|
type: typeText(binding.target),
|
|
169001
169945
|
source: sourceOf2(binding.ref, uri)
|
|
169002
169946
|
});
|
|
@@ -169106,7 +170050,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
169106
170050
|
const dn = dep;
|
|
169107
170051
|
const clients = (dn.clients ?? []).map((c) => resolveDrawnByText(String(c ?? ""))).filter((n2) => !!n2 && ids.has(n2));
|
|
169108
170052
|
const suppliers = (dn.suppliers ?? []).map((s) => resolveDrawnByText(String(s ?? ""))).filter((n2) => !!n2 && ids.has(n2));
|
|
169109
|
-
const label =
|
|
170053
|
+
const label = nameOf3(dep) ? `\xABdependency\xBB ${nameOf3(dep)}` : "\xABdependency\xBB";
|
|
169110
170054
|
const isNary = (dn.clients?.length ?? 0) > 1 || (dn.suppliers?.length ?? 0) > 1;
|
|
169111
170055
|
if (!isNary) {
|
|
169112
170056
|
const from = clients[0];
|
|
@@ -169121,7 +170065,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
169121
170065
|
const hubId = `dependency-hub-${dep.$cstNode?.offset ?? nodes.length}`;
|
|
169122
170066
|
nodes.push({
|
|
169123
170067
|
id: hubId,
|
|
169124
|
-
name:
|
|
170068
|
+
name: nameOf3(dep) ?? "",
|
|
169125
170069
|
keyword: "dependency",
|
|
169126
170070
|
isDef: false,
|
|
169127
170071
|
shape: "dot",
|
|
@@ -169184,7 +170128,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
169184
170128
|
const dotId = `__derivation_${derivationCount++}__`;
|
|
169185
170129
|
nodes.push({
|
|
169186
170130
|
id: dotId,
|
|
169187
|
-
name:
|
|
170131
|
+
name: nameOf3(c) ?? "derivation",
|
|
169188
170132
|
keyword: "derivation",
|
|
169189
170133
|
isDef: false,
|
|
169190
170134
|
shape: "dot",
|
|
@@ -169248,19 +170192,19 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
169248
170192
|
if (m.$type === "CommentStmt") {
|
|
169249
170193
|
const rawTargets = m.targets ?? [];
|
|
169250
170194
|
const targets = rawTargets.length ? this.commentTargets(m, index2).map(drawnAnnotationTarget).filter((target) => target !== void 0) : void 0;
|
|
169251
|
-
annotate(m, "comment",
|
|
170195
|
+
annotate(m, "comment", nameOf3(m) ?? "comment", annotationText(trailingBlockBody(m)), targets);
|
|
169252
170196
|
} else if (m.$type === "RepStmt") {
|
|
169253
170197
|
const lang = `language "${String(m.language ?? "")}"`;
|
|
169254
170198
|
const body = annotationText(trailingBlockBody(m));
|
|
169255
|
-
annotate(m, "rep",
|
|
170199
|
+
annotate(m, "rep", nameOf3(m) ?? "rep", body ? `${lang} - ${body}` : lang, void 0);
|
|
169256
170200
|
} else if (m.$type === "DocCommentMember") {
|
|
169257
170201
|
const owner = semanticOwner(m);
|
|
169258
170202
|
const body = annotationText(docCommentBody(m));
|
|
169259
|
-
annotate(m, "doc",
|
|
170203
|
+
annotate(m, "doc", nameOf3(m) ?? "doc", body, owner ? [owner] : void 0);
|
|
169260
170204
|
} else if ((isMetadataDecl(m) || m.$type === "MetadataAnnotation") && m.isDef !== true && annotationNodeSet.has(m) && !emitted.has(m)) {
|
|
169261
170205
|
const attrs = metadataAttrsText(m);
|
|
169262
170206
|
const detail = typeText(m) ? `${typeText(m)}${attrs ? ` { ${attrs} }` : ""}` : attrs;
|
|
169263
|
-
const declaredName3 =
|
|
170207
|
+
const declaredName3 = nameOf3(m) ?? m.declName;
|
|
169264
170208
|
annotate(m, "metadata", declaredName3 ?? lastSeg(typeText(m) ?? "metadata"), detail, void 0);
|
|
169265
170209
|
}
|
|
169266
170210
|
}
|
|
@@ -169282,7 +170226,7 @@ ${edge.to}`));
|
|
|
169282
170226
|
node.meta = {
|
|
169283
170227
|
...node.meta,
|
|
169284
170228
|
gvExplicit: true,
|
|
169285
|
-
gvDeclaredName:
|
|
170229
|
+
gvDeclaredName: nameOf3(original) ?? (original.$type === "MetadataAnnotation" ? original.declName : void 0),
|
|
169286
170230
|
gvMetadataAnnotation: original.$type === "MetadataAnnotation" || void 0,
|
|
169287
170231
|
...original.$type === "DocCommentMember" ? { gvDocumentation: docCommentBody(original) ?? "" } : {},
|
|
169288
170232
|
gvOwnerId: ownerId,
|
|
@@ -169765,7 +170709,7 @@ ${node.id}`;
|
|
|
169765
170709
|
const resolved = this.featurePaths.resolveDeclarationPath(member);
|
|
169766
170710
|
const localPath = reference.path === reference.simpleName || reference.path.replaceAll("::", ".") === `self.${reference.simpleName}`;
|
|
169767
170711
|
const effective = interconnection && localPath ? members.find((candidate) => (isConstraintDecl(candidate) || isInlineConstraintClaim(candidate)) && [effectiveNameOf(candidate), ...redefinitionTargetsOf(candidate).map(lastSeg)].includes(reference.simpleName)) : void 0;
|
|
169768
|
-
const found = effective ?? resolved.segments.at(-1)?.target ?? membersOf(owner).find((candidate) => candidate !== member &&
|
|
170712
|
+
const found = effective ?? resolved.segments.at(-1)?.target ?? membersOf(owner).find((candidate) => candidate !== member && nameOf3(candidate) === reference.path) ?? index2.get(reference.path) ?? index2.get(reference.simpleName);
|
|
169769
170713
|
if (!found || found === member)
|
|
169770
170714
|
continue;
|
|
169771
170715
|
target = found;
|
|
@@ -169839,8 +170783,8 @@ ${node.id}`;
|
|
|
169839
170783
|
if (existing)
|
|
169840
170784
|
return existing;
|
|
169841
170785
|
const parent = ensurePkgFrame(enclosingPackage(pkg));
|
|
169842
|
-
const id2 = qnameOf(pkg) ||
|
|
169843
|
-
frames.push({ id: id2, label:
|
|
170786
|
+
const id2 = qnameOf(pkg) || nameOf3(pkg) || `__pkg_${frames.length}__`;
|
|
170787
|
+
frames.push({ id: id2, label: nameOf3(pkg) ?? lastSeg(id2), keyword: "package", parent, source: sourceOf2(pkg, uri) });
|
|
169844
170788
|
pkgFrame.set(pkg, id2);
|
|
169845
170789
|
return id2;
|
|
169846
170790
|
};
|
|
@@ -169857,8 +170801,8 @@ ${node.id}`;
|
|
|
169857
170801
|
const constraint = isConstraintDecl(member) || isInlineConstraintClaim(member);
|
|
169858
170802
|
if (namedRelationship || constraint) {
|
|
169859
170803
|
const names = [
|
|
169860
|
-
|
|
169861
|
-
|
|
170804
|
+
nameOf3(member),
|
|
170805
|
+
redefinedNameOf2(member),
|
|
169862
170806
|
...constraint ? redefinitionTargetsOf(member).map(lastSeg) : []
|
|
169863
170807
|
].filter((name) => name !== void 0);
|
|
169864
170808
|
if (names.some((name) => claimedNames.has(name)))
|
|
@@ -169962,8 +170906,8 @@ ${node.id}`;
|
|
|
169962
170906
|
pendingDefinitions.push(typeDef);
|
|
169963
170907
|
}
|
|
169964
170908
|
const typeQ = typeDef ? qnameOf(typeDef) : void 0;
|
|
169965
|
-
const declarationId =
|
|
169966
|
-
const projected =
|
|
170909
|
+
const declarationId = nameOf3(part) ? qnameOf(part) || instanceId : instanceId;
|
|
170910
|
+
const projected = nameOf3(part) === void 0 || declarationId !== instanceId;
|
|
169967
170911
|
const localUsage = part.isDef !== true && !projected ? part : inheritedLocalUsage;
|
|
169968
170912
|
const localPath = part.isDef !== true && !projected ? [] : inheritedLocalPath;
|
|
169969
170913
|
const projectedPorts = this.portsOf(part, index2, uri, instanceId, localUsage);
|
|
@@ -169984,7 +170928,7 @@ ${node.id}`;
|
|
|
169984
170928
|
const children2 = depth < 8 && !(typeQ !== void 0 && seenTypes.has(typeQ)) ? childUsagesOf(part) : [];
|
|
169985
170929
|
const concretePerformPath = (statement, target2) => {
|
|
169986
170930
|
if (!this.isAnonymousBehaviorReference(statement)) {
|
|
169987
|
-
return qnameOf(statement) ||
|
|
170931
|
+
return qnameOf(statement) || nameOf3(statement) || "perform";
|
|
169988
170932
|
}
|
|
169989
170933
|
const segments = this.featurePaths.resolveDeclarationPath(statement).segments;
|
|
169990
170934
|
const featureStart = segments.findIndex((segment, at) => at > 0 && segment.separator === ".");
|
|
@@ -169997,7 +170941,7 @@ ${node.id}`;
|
|
|
169997
170941
|
const rootSegments = segments.slice(0, featureStart).map((segment) => segment.text);
|
|
169998
170942
|
const rootName = rootSegments.at(-1);
|
|
169999
170943
|
const wanted = rootSegments.join("::");
|
|
170000
|
-
const declaresRoot = (candidate) => candidate !== statement && !this.referencesBehavior(candidate) &&
|
|
170944
|
+
const declaresRoot = (candidate) => candidate !== statement && !this.referencesBehavior(candidate) && nameOf3(candidate) === rootName;
|
|
170001
170945
|
let root4;
|
|
170002
170946
|
for (let owner = statement.$container; owner && !root4; owner = owner.$container) {
|
|
170003
170947
|
const local = membersOf(owner).find(declaresRoot);
|
|
@@ -170009,16 +170953,16 @@ ${node.id}`;
|
|
|
170009
170953
|
return [qnameOf(root4), ...segments.slice(featureStart).map((segment) => segment.text)].join("::");
|
|
170010
170954
|
}
|
|
170011
170955
|
}
|
|
170012
|
-
return qnameOf(target2) ||
|
|
170956
|
+
return qnameOf(target2) || nameOf3(target2) || segments.map((segment) => segment.text).join("::");
|
|
170013
170957
|
};
|
|
170014
|
-
const performedActions = depth < 8 && !(typeQ !== void 0 && seenTypes.has(typeQ)) ? effectiveMembersOf(part).filter((m) => m.$type === "PerformStmt" && !!
|
|
170958
|
+
const performedActions = depth < 8 && !(typeQ !== void 0 && seenTypes.has(typeQ)) ? effectiveMembersOf(part).filter((m) => m.$type === "PerformStmt" && !!nameOf3(m)).map((act) => {
|
|
170015
170959
|
const pinSource = this.performTargetOf(act, index2) ?? act;
|
|
170016
|
-
const pathSegments4 = this.isAnonymousBehaviorReference(act) ? this.featurePaths.resolveDeclarationPath(act).segments.map((segment) => segment.text) : [
|
|
170960
|
+
const pathSegments4 = this.isAnonymousBehaviorReference(act) ? this.featurePaths.resolveDeclarationPath(act).segments.map((segment) => segment.text) : [nameOf3(act)];
|
|
170017
170961
|
return {
|
|
170018
170962
|
act,
|
|
170019
170963
|
pinSource,
|
|
170020
170964
|
pathSegments: pathSegments4,
|
|
170021
|
-
name: pathSegments4.at(-1) ??
|
|
170965
|
+
name: pathSegments4.at(-1) ?? nameOf3(act),
|
|
170022
170966
|
key: concretePerformPath(act, pinSource)
|
|
170023
170967
|
};
|
|
170024
170968
|
}).filter((entry, i, list) => list.findIndex((other) => other.key === entry.key) === i) : [];
|
|
@@ -170115,7 +171059,7 @@ ${node.id}`;
|
|
|
170115
171059
|
claimFrame.compartments = withoutCompartments(claimFrame.compartments, "assert constraints", "assume constraints", "require constraints");
|
|
170116
171060
|
};
|
|
170117
171061
|
const packageOfRoot = (root4) => enclosingPackage(root4) ?? scope;
|
|
170118
|
-
const rootBaseId = (root4) => qnameOf(root4) ||
|
|
171062
|
+
const rootBaseId = (root4) => qnameOf(root4) || nameOf3(root4) || `__root_${root4.$cstNode?.offset ?? 0}__`;
|
|
170119
171063
|
const rootsByBaseId = /* @__PURE__ */ new Map();
|
|
170120
171064
|
for (const root4 of roots) {
|
|
170121
171065
|
const base = rootBaseId(root4);
|
|
@@ -170153,7 +171097,7 @@ ${node.id}`;
|
|
|
170153
171097
|
continue;
|
|
170154
171098
|
if (!ownedByDiagramRoot(definition, diagramRoot))
|
|
170155
171099
|
continue;
|
|
170156
|
-
const definitionId = qnameOf(definition) ||
|
|
171100
|
+
const definitionId = qnameOf(definition) || nameOf3(definition);
|
|
170157
171101
|
if (!definitionId)
|
|
170158
171102
|
continue;
|
|
170159
171103
|
renderedDefinitions.add(definition);
|
|
@@ -170179,7 +171123,7 @@ ${node.id}`;
|
|
|
170179
171123
|
// rendered by the SAME recursive renderer as the package overview.
|
|
170180
171124
|
buildInterconnectionView(ctx) {
|
|
170181
171125
|
const anchor = ctx.anchor;
|
|
170182
|
-
const anchorId = qnameOf(anchor) ||
|
|
171126
|
+
const anchorId = qnameOf(anchor) || nameOf3(anchor) || "__anchor__";
|
|
170183
171127
|
const { nodes, edges, frames, definitionLayer } = this.renderIvRoots(ctx, [anchor], { packageFrames: false });
|
|
170184
171128
|
if (anchor.isDef === true && frames.length === 0 && nodes.every((n2) => !n2.ports?.length && !n2.compartments?.length)) {
|
|
170185
171129
|
return this.model("iv", anchor, [], []);
|
|
@@ -170216,14 +171160,14 @@ ${node.id}`;
|
|
|
170216
171160
|
const candidates = nodes.filter((node) => node.meta?.constraintUsage === true && (!frameId || node.id.startsWith(`${frameId}::`) || edges.some((edge) => edge.from === frameId && edge.to === node.id))).flatMap((node) => (node.ports ?? []).filter((pin) => `${node.name}.${pin.name}` === path10 || pin.id.replaceAll("::", ".") === path10));
|
|
170217
171161
|
if (candidates.length === 1)
|
|
170218
171162
|
return candidates[0].id;
|
|
170219
|
-
const attribute = memberList2.find((member) => isAttributeDecl(member) &&
|
|
171163
|
+
const attribute = memberList2.find((member) => isAttributeDecl(member) && nameOf3(member) === path10);
|
|
170220
171164
|
if (!attribute || !frameId)
|
|
170221
171165
|
return void 0;
|
|
170222
|
-
const id2 = `${frameId}::${
|
|
171166
|
+
const id2 = `${frameId}::${nameOf3(attribute)}`;
|
|
170223
171167
|
if (!nodes.some((node) => node.id === id2))
|
|
170224
171168
|
nodes.push({
|
|
170225
171169
|
id: id2,
|
|
170226
|
-
name:
|
|
171170
|
+
name: nameOf3(attribute),
|
|
170227
171171
|
keyword: "attribute",
|
|
170228
171172
|
isDef: false,
|
|
170229
171173
|
shape: "box",
|
|
@@ -170339,7 +171283,7 @@ ${node.id}`;
|
|
|
170339
171283
|
for (const m of memberList2) {
|
|
170340
171284
|
if (isConnectorDecl(m)) {
|
|
170341
171285
|
const cn = m;
|
|
170342
|
-
const name =
|
|
171286
|
+
const name = nameOf3(m);
|
|
170343
171287
|
const type = typeText(m);
|
|
170344
171288
|
const label = name ?? type;
|
|
170345
171289
|
const clauseEnds = (cn.ends ?? []).map((clause) => clause.end).filter(Boolean);
|
|
@@ -170417,7 +171361,7 @@ ${node.id}`;
|
|
|
170417
171361
|
} else if (isInterfaceDecl(m) && m.isDef !== true) {
|
|
170418
171362
|
const interfaceUsage = m;
|
|
170419
171363
|
if (interfaceUsage.target !== void 0 && interfaceUsage.connect === void 0) {
|
|
170420
|
-
const sourcePath = shorthandSourcePath(m) ?? [
|
|
171364
|
+
const sourcePath = shorthandSourcePath(m) ?? [nameOf3(m) ?? "", ...interfaceUsage.srcSegs ?? []].filter(Boolean).join(".");
|
|
170421
171365
|
const targetPath = this.featurePath(interfaceUsage.target) ?? "";
|
|
170422
171366
|
const from = resolveEnd(sourcePath);
|
|
170423
171367
|
const to = resolveEnd(targetPath);
|
|
@@ -170707,8 +171651,8 @@ ${node.id}`;
|
|
|
170707
171651
|
const { index: index2 } = ctx;
|
|
170708
171652
|
const scope = ctx.anchor;
|
|
170709
171653
|
const all = [...ast_utils_exports.streamAllContents(scope)];
|
|
170710
|
-
const isUsagePart = (n2) => isPartDecl(n2) && n2.isDef !== true &&
|
|
170711
|
-
const isDefPart = (n2) => isPartDecl(n2) && n2.isDef === true &&
|
|
171654
|
+
const isUsagePart = (n2) => isPartDecl(n2) && n2.isDef !== true && nameOf3(n2) !== void 0;
|
|
171655
|
+
const isDefPart = (n2) => isPartDecl(n2) && n2.isDef === true && nameOf3(n2) !== void 0;
|
|
170712
171656
|
const hasInternalParts = (d) => [d, ...this.inheritedFeatureOwnersOf(d, index2)].some((source) => this.nestedUsages(source, isPartDecl).length > 0);
|
|
170713
171657
|
const insideAPart = (n2) => {
|
|
170714
171658
|
let c = n2.$container;
|
|
@@ -170734,7 +171678,7 @@ ${node.id}`;
|
|
|
170734
171678
|
if (def && isDefPart(def))
|
|
170735
171679
|
usedDefs.add(def);
|
|
170736
171680
|
}
|
|
170737
|
-
const byName = (a2, b) => (qnameOf(a2) ||
|
|
171681
|
+
const byName = (a2, b) => (qnameOf(a2) || nameOf3(a2) || "").localeCompare(qnameOf(b) || nameOf3(b) || "");
|
|
170738
171682
|
const rootDefs = all.filter((d) => isDefPart(d) && !usedDefs.has(d) && !insideAPart(d) && !insideAnOccurrence(d) && hasInternalParts(d));
|
|
170739
171683
|
const rootUsages = all.filter((u) => isUsagePart(u) && !insideAPart(u) && !insideAnOccurrence(u));
|
|
170740
171684
|
let roots = [...rootDefs, ...rootUsages].sort(byName);
|
|
@@ -170747,7 +171691,7 @@ ${node.id}`;
|
|
|
170747
171691
|
if (definitionLayer)
|
|
170748
171692
|
model.layers = { definitions: definitionLayer };
|
|
170749
171693
|
model.meta = { ...model.meta, overview: true, groupMode: "nested" };
|
|
170750
|
-
model.root = { ...model.root, keyword: "package", name:
|
|
171694
|
+
model.root = { ...model.root, keyword: "package", name: nameOf3(scope) ?? model.root.name };
|
|
170751
171695
|
if (nodes.length === 0 && frames.length === 0) {
|
|
170752
171696
|
model.notes = ["No internal parts to interconnect in this package."];
|
|
170753
171697
|
}
|
|
@@ -170766,7 +171710,7 @@ ${node.id}`;
|
|
|
170766
171710
|
}
|
|
170767
171711
|
return false;
|
|
170768
171712
|
});
|
|
170769
|
-
const scaffolds = kind === "stv" ? all.filter((n2) => (isStateDecl(n2) || isExhibitStateDecl(n2)) && !!
|
|
171713
|
+
const scaffolds = kind === "stv" ? all.filter((n2) => (isStateDecl(n2) || isExhibitStateDecl(n2)) && !!nameOf3(n2) && // A REFERENCING `exhibit s;` is a claim on a state declared
|
|
170770
171714
|
// elsewhere (OMG p.116 shorthand), drawn as that state's «exhibit»
|
|
170771
171715
|
// arrow — never a machine of its own (report 2026-08-03).
|
|
170772
171716
|
!this.referencesBehavior(n2) && !naturalAnchors.includes(n2) && !hasNaturalDescendant(n2) && // A nested state is a member of the machine that already tiles.
|
|
@@ -170796,13 +171740,13 @@ ${node.id}`;
|
|
|
170796
171740
|
// package-anchored single-view behaviour), not only nested container parts.
|
|
170797
171741
|
hasOverviewContent(scope, kind, index2) {
|
|
170798
171742
|
if (kind === "iv") {
|
|
170799
|
-
return [...ast_utils_exports.streamAllContents(scope)].some((n2) => isPartDecl(n2) && n2.isDef !== true &&
|
|
171743
|
+
return [...ast_utils_exports.streamAllContents(scope)].some((n2) => isPartDecl(n2) && n2.isDef !== true && nameOf3(n2) !== void 0);
|
|
170800
171744
|
}
|
|
170801
171745
|
if (this.collectOverviewAnchors(scope, kind, index2).length > 0)
|
|
170802
171746
|
return true;
|
|
170803
171747
|
if (kind === "gev")
|
|
170804
171748
|
return this.hasGeometryObject(scope, index2);
|
|
170805
|
-
return kind === "sv" && this.nestedUsages(scope, isPartDecl).some((n2) =>
|
|
171749
|
+
return kind === "sv" && this.nestedUsages(scope, isPartDecl).some((n2) => nameOf3(n2) !== void 0);
|
|
170806
171750
|
}
|
|
170807
171751
|
// REQ-202 — only a real message/send interaction becomes a package tile;
|
|
170808
171752
|
// nested part composition alone is not a sequence.
|
|
@@ -170816,8 +171760,8 @@ ${node.id}`;
|
|
|
170816
171760
|
// webview can lay each tile out with its own view layout.
|
|
170817
171761
|
buildTiledOverview(ctx, kind, groupMode, buildOne, emptyNote) {
|
|
170818
171762
|
const scopeQ = qnameOf(ctx.anchor);
|
|
170819
|
-
const collected = this.collectOverviewAnchors(ctx.anchor, kind, ctx.index).sort((a2, b) => (qnameOf(a2) ||
|
|
170820
|
-
const sequenceScaffold = kind === "sv" && this.nestedUsages(ctx.anchor, isPartDecl).some((n2) =>
|
|
171763
|
+
const collected = this.collectOverviewAnchors(ctx.anchor, kind, ctx.index).sort((a2, b) => (qnameOf(a2) || nameOf3(a2) || "").localeCompare(qnameOf(b) || nameOf3(b) || ""));
|
|
171764
|
+
const sequenceScaffold = kind === "sv" && this.nestedUsages(ctx.anchor, isPartDecl).some((n2) => nameOf3(n2) !== void 0);
|
|
170821
171765
|
const useScopeFallback = kind === "gev" ? this.hasPlacedGeometryObject(ctx.anchor, ctx.index) : sequenceScaffold;
|
|
170822
171766
|
const anchors = collected.length > 0 ? collected : useScopeFallback ? [ctx.anchor] : [];
|
|
170823
171767
|
const nodes = [];
|
|
@@ -170836,12 +171780,12 @@ ${node.id}`;
|
|
|
170836
171780
|
if (this.diagramElementCount(subModel) === 0 && !(kind === "afv" && (isActionDecl(sub) || isCalcDecl(sub))) && !(kind === "stv" && (isStateDecl(sub) || isExhibitStateDecl(sub))))
|
|
170837
171781
|
continue;
|
|
170838
171782
|
const frameId = `t${tile}`;
|
|
170839
|
-
const q = qnameOf(sub) ||
|
|
170840
|
-
const rel2 = scopeQ && q.startsWith(`${scopeQ}::`) ? q.slice(scopeQ.length + 2) :
|
|
171783
|
+
const q = qnameOf(sub) || nameOf3(sub) || "";
|
|
171784
|
+
const rel2 = scopeQ && q.startsWith(`${scopeQ}::`) ? q.slice(scopeQ.length + 2) : nameOf3(sub) ?? q;
|
|
170841
171785
|
const tileMetaTag = kind === "afv" ? isPartDecl(sub) ? { afvPart: true } : (isActionDecl(sub) || isCalcDecl(sub)) && sub.isDef === true ? { behaviorDef: true } : void 0 : kind === "stv" && sub.isDef === true ? { behaviorDef: true } : void 0;
|
|
170842
171786
|
const tileIdentity = {
|
|
170843
|
-
declarationId: qnameOf(sub) ||
|
|
170844
|
-
declarationName:
|
|
171787
|
+
declarationId: qnameOf(sub) || nameOf3(sub),
|
|
171788
|
+
declarationName: nameOf3(sub),
|
|
170845
171789
|
declarationSource: sourceOf2(sub, ctx.uri)
|
|
170846
171790
|
};
|
|
170847
171791
|
const anchorFrame = subModel.frames?.find((f) => f.meta?.anchorFrame === true);
|
|
@@ -170849,7 +171793,7 @@ ${node.id}`;
|
|
|
170849
171793
|
frames.push({
|
|
170850
171794
|
id: frameId,
|
|
170851
171795
|
layoutKey: q || void 0,
|
|
170852
|
-
label: rel2 || (
|
|
171796
|
+
label: rel2 || (nameOf3(sub) ?? "view"),
|
|
170853
171797
|
keyword: keywordFor(sub),
|
|
170854
171798
|
// If a single-view builder wrapped its anchor in a semantic
|
|
170855
171799
|
// boundary (for example STV `exhibit`), absorption replaces the
|
|
@@ -170881,7 +171825,7 @@ ${node.id}`;
|
|
|
170881
171825
|
const model = this.model(kind, ctx.anchor, nodes, edges);
|
|
170882
171826
|
model.frames = frames;
|
|
170883
171827
|
model.meta = { overview: true, groupMode, tileMeta };
|
|
170884
|
-
model.root = { ...model.root, keyword: "package", name:
|
|
171828
|
+
model.root = { ...model.root, keyword: "package", name: nameOf3(ctx.anchor) ?? model.root.name };
|
|
170885
171829
|
if (frames.length === 0)
|
|
170886
171830
|
model.notes = [emptyNote];
|
|
170887
171831
|
return model;
|
|
@@ -171061,22 +172005,22 @@ ${node.id}`;
|
|
|
171061
172005
|
let anon = 0;
|
|
171062
172006
|
const anchorHostsFlow = isActionDecl(anchor) || isCalcDecl(anchor) || this.isCaseLike(anchor);
|
|
171063
172007
|
const exprTextOf = (v) => (v?.$cstNode?.text ?? (typeof v === "string" ? v : "")).replace(/\s+/g, " ").trim();
|
|
171064
|
-
const performPathOf = (m) => [
|
|
172008
|
+
const performPathOf = (m) => [nameOf3(m), ...m.chainSegs ?? []].filter((segment) => !!segment);
|
|
171065
172009
|
const performLabel = (m) => performPathOf(m).at(-1) ?? typeText(m) ?? "perform";
|
|
171066
|
-
const localFlowName = (m) => m.$type === "PerformStmt" && this.isAnonymousBehaviorReference(m) ? void 0 :
|
|
172010
|
+
const localFlowName = (m) => m.$type === "PerformStmt" && this.isAnonymousBehaviorReference(m) ? void 0 : nameOf3(m);
|
|
171067
172011
|
const isPromotablePerform = (m) => m.$type === "PerformStmt" && this.isAnonymousBehaviorReference(m) && isActionDecl(this.declaringOwnerOf(m));
|
|
171068
172012
|
const flowNodeInfo = (m) => {
|
|
171069
172013
|
const mm = m;
|
|
171070
172014
|
switch (m.$type) {
|
|
171071
172015
|
// REQ-208 - Calculations share action occurrence docking.
|
|
171072
172016
|
case "CalcDecl":
|
|
171073
|
-
return { shape: "action", label:
|
|
172017
|
+
return { shape: "action", label: nameOf3(m) ?? "calc" };
|
|
171074
172018
|
case "ActionDecl": {
|
|
171075
|
-
if (!
|
|
172019
|
+
if (!nameOf3(m))
|
|
171076
172020
|
return void 0;
|
|
171077
172021
|
const inlineAccept = mm.inlineBody;
|
|
171078
172022
|
if (inlineAccept?.$type === "AcceptNode") {
|
|
171079
|
-
return { shape: "accept", label:
|
|
172023
|
+
return { shape: "accept", label: nameOf3(m) };
|
|
171080
172024
|
}
|
|
171081
172025
|
if (inlineAccept?.$type === "AssignNode") {
|
|
171082
172026
|
const assign2 = inlineAccept;
|
|
@@ -171087,12 +172031,12 @@ ${node.id}`;
|
|
|
171087
172031
|
};
|
|
171088
172032
|
}
|
|
171089
172033
|
if (inlineAccept?.$type === "TerminateNode") {
|
|
171090
|
-
return { shape: "action", label:
|
|
172034
|
+
return { shape: "action", label: nameOf3(m) };
|
|
171091
172035
|
}
|
|
171092
172036
|
if (mm.sendKw === true) {
|
|
171093
|
-
return { shape: "send", label:
|
|
172037
|
+
return { shape: "send", label: nameOf3(m) };
|
|
171094
172038
|
}
|
|
171095
|
-
return { shape: "action", label:
|
|
172039
|
+
return { shape: "action", label: nameOf3(m) };
|
|
171096
172040
|
}
|
|
171097
172041
|
// REQ-196 — a `perform` names the action it performs, which for a
|
|
171098
172042
|
// feature chain (`perform action0.action1;`) is the LAST segment:
|
|
@@ -171101,13 +172045,13 @@ ${node.id}`;
|
|
|
171101
172045
|
case "PerformStmt":
|
|
171102
172046
|
return { shape: "action", label: performLabel(m) };
|
|
171103
172047
|
case "MergeNode":
|
|
171104
|
-
return { shape: "merge", label:
|
|
172048
|
+
return { shape: "merge", label: nameOf3(m) ?? "" };
|
|
171105
172049
|
case "DecideNode":
|
|
171106
|
-
return { shape: "decision", label:
|
|
172050
|
+
return { shape: "decision", label: nameOf3(m) ?? "" };
|
|
171107
172051
|
case "JoinNode":
|
|
171108
|
-
return { shape: "join", label:
|
|
172052
|
+
return { shape: "join", label: nameOf3(m) ?? "" };
|
|
171109
172053
|
case "ForkNode":
|
|
171110
|
-
return { shape: "fork", label:
|
|
172054
|
+
return { shape: "fork", label: nameOf3(m) ?? "" };
|
|
171111
172055
|
case "TerminateNode":
|
|
171112
172056
|
return {
|
|
171113
172057
|
shape: "terminate",
|
|
@@ -171156,7 +172100,7 @@ ${node.id}`;
|
|
|
171156
172100
|
const isLoopNode = (m) => m.$type === "WhileLoopNode" || m.$type === "LoopNode" || m.$type === "ForLoopNode";
|
|
171157
172101
|
const isStructuredIf = (m) => m.$type === "IfActionNode" && !m.thenTarget;
|
|
171158
172102
|
const inlineStructuredNodeOf = (m) => {
|
|
171159
|
-
if (m.$type !== "ActionDecl" || !
|
|
172103
|
+
if (m.$type !== "ActionDecl" || !nameOf3(m))
|
|
171160
172104
|
return void 0;
|
|
171161
172105
|
const inline = m.inlineBody;
|
|
171162
172106
|
return inline && (isLoopNode(inline) || isStructuredIf(inline)) ? inline : void 0;
|
|
@@ -171183,8 +172127,8 @@ ${node.id}`;
|
|
|
171183
172127
|
if (isFlowMember(node))
|
|
171184
172128
|
out.push(node);
|
|
171185
172129
|
const memberInline = node.inlineBody;
|
|
171186
|
-
const foldedAcceptTrigger = node.$type === "ActionDecl" && !!
|
|
171187
|
-
const foldedAssignment = node.$type === "ActionDecl" && !!
|
|
172130
|
+
const foldedAcceptTrigger = node.$type === "ActionDecl" && !!nameOf3(node) && memberInline?.$type === "AcceptNode";
|
|
172131
|
+
const foldedAssignment = node.$type === "ActionDecl" && !!nameOf3(node) && memberInline?.$type === "AssignNode";
|
|
171188
172132
|
const foldedStructuredAction = inlineStructuredNodeOf(node) === memberInline;
|
|
171189
172133
|
if (memberInline && flowNodeInfo(memberInline) && !foldedAcceptTrigger && !foldedAssignment && !foldedStructuredAction)
|
|
171190
172134
|
out.push(memberInline);
|
|
@@ -171225,7 +172169,7 @@ ${node.id}`;
|
|
|
171225
172169
|
if (!rootName)
|
|
171226
172170
|
return void 0;
|
|
171227
172171
|
const wanted = rootSegments.join("::");
|
|
171228
|
-
const declares = (candidate) => candidate !== statement && !this.referencesBehavior(candidate) &&
|
|
172172
|
+
const declares = (candidate) => candidate !== statement && !this.referencesBehavior(candidate) && nameOf3(candidate) === rootName;
|
|
171229
172173
|
for (let owner = statement.$container; owner; owner = owner.$container) {
|
|
171230
172174
|
const local = membersOf(owner).find(declares);
|
|
171231
172175
|
if (local && (rootSegments.length === 1 || qnameOf(local).endsWith(wanted)))
|
|
@@ -171247,7 +172191,7 @@ ${node.id}`;
|
|
|
171247
172191
|
return [rootName, ...segments.slice(featureStart).map((segment) => segment.text)].join("::");
|
|
171248
172192
|
}
|
|
171249
172193
|
}
|
|
171250
|
-
return qnameOf(target) ||
|
|
172194
|
+
return qnameOf(target) || nameOf3(target) || segments.map((segment) => segment.text).join("::");
|
|
171251
172195
|
};
|
|
171252
172196
|
const performerOf = /* @__PURE__ */ new Map();
|
|
171253
172197
|
const performerClaimsOf = /* @__PURE__ */ new Map();
|
|
@@ -171269,7 +172213,7 @@ ${node.id}`;
|
|
|
171269
172213
|
if (!performers.includes(part))
|
|
171270
172214
|
performers.push(part);
|
|
171271
172215
|
performerOf.set(occurrence, performers);
|
|
171272
|
-
const partId = qnameOf(part) ||
|
|
172216
|
+
const partId = qnameOf(part) || nameOf3(part) || "?";
|
|
171273
172217
|
const byPart = performerClaimsOf.get(occurrence) ?? /* @__PURE__ */ new Map();
|
|
171274
172218
|
const sources = byPart.get(partId) ?? [];
|
|
171275
172219
|
const claimSource = sourceOf2(stmt, uri);
|
|
@@ -171341,7 +172285,7 @@ ${node.id}`;
|
|
|
171341
172285
|
return [...byName.values()];
|
|
171342
172286
|
};
|
|
171343
172287
|
const registerPins = (owner, ownerId, pins, includeBare) => {
|
|
171344
|
-
const ownerNames = new Set([
|
|
172288
|
+
const ownerNames = new Set([nameOf3(owner), qnameOf(owner), ownerId].filter((value) => !!value));
|
|
171345
172289
|
const occurrenceSegments = normalizePinPath(ownerId).split(".").filter(Boolean);
|
|
171346
172290
|
for (let start2 = 0; start2 < occurrenceSegments.length; start2++) {
|
|
171347
172291
|
ownerNames.add(occurrenceSegments.slice(start2).join("."));
|
|
@@ -171364,20 +172308,20 @@ ${node.id}`;
|
|
|
171364
172308
|
const scopeQName = qnameOf(this.packageScopeOf(anchor));
|
|
171365
172309
|
const relativeName = (node) => {
|
|
171366
172310
|
const q = qnameOf(node);
|
|
171367
|
-
return scopeQName && q.startsWith(`${scopeQName}::`) ? q.slice(scopeQName.length + 2) : q ||
|
|
172311
|
+
return scopeQName && q.startsWith(`${scopeQName}::`) ? q.slice(scopeQName.length + 2) : q || nameOf3(node) || "?";
|
|
171368
172312
|
};
|
|
171369
172313
|
const referencePath = (node) => {
|
|
171370
172314
|
const scope = this.packageScopeOf(anchor);
|
|
171371
172315
|
const chain = [];
|
|
171372
172316
|
for (let current2 = node; current2 && current2 !== scope && !isDocument(current2); current2 = current2.$container) {
|
|
171373
|
-
if (
|
|
172317
|
+
if (nameOf3(current2))
|
|
171374
172318
|
chain.unshift(current2);
|
|
171375
172319
|
}
|
|
171376
172320
|
if (chain.length === 0)
|
|
171377
172321
|
return relativeName(node);
|
|
171378
|
-
let text =
|
|
172322
|
+
let text = nameOf3(chain[0]);
|
|
171379
172323
|
for (let index3 = 1; index3 < chain.length; index3 += 1) {
|
|
171380
|
-
text += memberSeparator(chain[index3 - 1]) +
|
|
172324
|
+
text += memberSeparator(chain[index3 - 1]) + nameOf3(chain[index3]);
|
|
171381
172325
|
}
|
|
171382
172326
|
return text;
|
|
171383
172327
|
};
|
|
@@ -171389,8 +172333,8 @@ ${node.id}`;
|
|
|
171389
172333
|
return {};
|
|
171390
172334
|
return {
|
|
171391
172335
|
performPath: edit.performPath,
|
|
171392
|
-
localUsageId: qnameOf(edit.root) ||
|
|
171393
|
-
localUsageName:
|
|
172336
|
+
localUsageId: qnameOf(edit.root) || nameOf3(edit.root),
|
|
172337
|
+
localUsageName: nameOf3(edit.root),
|
|
171394
172338
|
localUsageSource: sourceOf2(edit.root, uri),
|
|
171395
172339
|
localUsagePath: edit.memberPath
|
|
171396
172340
|
};
|
|
@@ -171493,7 +172437,7 @@ ${node.id}`;
|
|
|
171493
172437
|
const frameCompartments = isActionDecl(holder) || isCalcDecl(holder) ? actionFeatureCompartments(holder) : withoutCompartments(this.compartmentsFor(holder, uri, index2), ...graphicalAfvTitles);
|
|
171494
172438
|
frames.push({
|
|
171495
172439
|
id: frameId,
|
|
171496
|
-
label:
|
|
172440
|
+
label: nameOf3(holder) ?? lastSeg(frameId),
|
|
171497
172441
|
keyword: keywordFor(holder),
|
|
171498
172442
|
parent: parentFrame,
|
|
171499
172443
|
isDef: holder.isDef === true,
|
|
@@ -171514,7 +172458,7 @@ ${node.id}`;
|
|
|
171514
172458
|
for (const m of flowMembersOf(holder))
|
|
171515
172459
|
emitChild(m, frameId, executionContext, holderOccurrence);
|
|
171516
172460
|
for (const cp of childParts) {
|
|
171517
|
-
const childId = qnameOf(cp) || `${frameId}::${
|
|
172461
|
+
const childId = qnameOf(cp) || `${frameId}::${nameOf3(cp) ?? "?"}`;
|
|
171518
172462
|
renderContainer(cp, childId, frameId, depth + 1, next, false, executionContext, childId);
|
|
171519
172463
|
}
|
|
171520
172464
|
};
|
|
@@ -171580,7 +172524,7 @@ ${node.id}`;
|
|
|
171580
172524
|
return;
|
|
171581
172525
|
}
|
|
171582
172526
|
const banner = loopBanner(loop);
|
|
171583
|
-
const wrapperName = wrapper ?
|
|
172527
|
+
const wrapperName = wrapper ? nameOf3(wrapper) : void 0;
|
|
171584
172528
|
const loopId = occurrence;
|
|
171585
172529
|
const body = loop.body;
|
|
171586
172530
|
const pins = structuredPinsOf(wrapper, [body], loopId);
|
|
@@ -171638,7 +172582,7 @@ ${node.id}`;
|
|
|
171638
172582
|
openFrames.delete(loop);
|
|
171639
172583
|
}
|
|
171640
172584
|
idByNode.set(loop, loopId);
|
|
171641
|
-
registerStep(occurrence, loopId, [
|
|
172585
|
+
registerStep(occurrence, loopId, [nameOf3(loop)]);
|
|
171642
172586
|
if (wrapper) {
|
|
171643
172587
|
idByNode.set(wrapper, loopId);
|
|
171644
172588
|
registerStep(occurrence, loopId, [wrapperName]);
|
|
@@ -171676,8 +172620,8 @@ ${node.id}`;
|
|
|
171676
172620
|
registerStep(occurrence, id2, [declaredName3]);
|
|
171677
172621
|
if (content !== action) {
|
|
171678
172622
|
idByNode.set(content, id2);
|
|
171679
|
-
if (isPartDecl(this.declaringOwnerOf(action)) &&
|
|
171680
|
-
addStepAlias(
|
|
172623
|
+
if (isPartDecl(this.declaringOwnerOf(action)) && nameOf3(content)) {
|
|
172624
|
+
addStepAlias(nameOf3(content), id2);
|
|
171681
172625
|
}
|
|
171682
172626
|
}
|
|
171683
172627
|
frameOfNode.set(action, id2);
|
|
@@ -171707,7 +172651,7 @@ ${node.id}`;
|
|
|
171707
172651
|
declarationSource: sourceOf2(action, uri)
|
|
171708
172652
|
} : {},
|
|
171709
172653
|
// REQ-196 — the body a lane added here writes its `perform` against.
|
|
171710
|
-
actionQName: qnameOf(content) ||
|
|
172654
|
+
actionQName: qnameOf(content) || nameOf3(content),
|
|
171711
172655
|
...occurrenceEditMeta(occurrence)
|
|
171712
172656
|
}
|
|
171713
172657
|
});
|
|
@@ -171724,8 +172668,8 @@ ${node.id}`;
|
|
|
171724
172668
|
return;
|
|
171725
172669
|
}
|
|
171726
172670
|
const inf = node;
|
|
171727
|
-
const declaredNode = wrapper ?? (
|
|
171728
|
-
const wrapperName = declaredNode ?
|
|
172671
|
+
const declaredNode = wrapper ?? (nameOf3(node) ? node : void 0);
|
|
172672
|
+
const wrapperName = declaredNode ? nameOf3(declaredNode) : void 0;
|
|
171729
172673
|
const frameId = occurrence;
|
|
171730
172674
|
const blocks = [inf.thenBody, inf.elseBody, inf.elseIf];
|
|
171731
172675
|
const pins = structuredPinsOf(declaredNode, blocks, frameId);
|
|
@@ -171769,7 +172713,7 @@ ${node.id}`;
|
|
|
171769
172713
|
recordLaneCandidate(frameId, true, parentFrameId, laneParts, occurrence);
|
|
171770
172714
|
frameOfNode.set(node, frameId);
|
|
171771
172715
|
idByNode.set(node, frameId);
|
|
171772
|
-
registerStep(occurrence, frameId, [
|
|
172716
|
+
registerStep(occurrence, frameId, [nameOf3(node)]);
|
|
171773
172717
|
if (wrapper) {
|
|
171774
172718
|
frameOfNode.set(wrapper, frameId);
|
|
171775
172719
|
idByNode.set(wrapper, frameId);
|
|
@@ -171809,7 +172753,7 @@ ${node.id}`;
|
|
|
171809
172753
|
}
|
|
171810
172754
|
openFrames.delete(node);
|
|
171811
172755
|
};
|
|
171812
|
-
const anchorId = qnameOf(anchor) ||
|
|
172756
|
+
const anchorId = qnameOf(anchor) || nameOf3(anchor) || "__anchor__";
|
|
171813
172757
|
renderContainer(anchor, anchorId, void 0, 0, /* @__PURE__ */ new Set(), true, void 0);
|
|
171814
172758
|
const flowFrameFor = (context, occurrenceContext) => {
|
|
171815
172759
|
if (occurrenceContext) {
|
|
@@ -172004,7 +172948,7 @@ ${node.id}`;
|
|
|
172004
172948
|
}
|
|
172005
172949
|
}
|
|
172006
172950
|
const readActions = /* @__PURE__ */ new Set();
|
|
172007
|
-
const bodyReadKey = (body, occurrence) => `${qnameOf(body) ||
|
|
172951
|
+
const bodyReadKey = (body, occurrence) => `${qnameOf(body) || nameOf3(body) || body.$type}\0${normalizeOccurrencePath(occurrence)}`;
|
|
172008
172952
|
const readDefinitionBody = (holder, holderOccurrence) => {
|
|
172009
172953
|
if (holder.isDef === true)
|
|
172010
172954
|
return;
|
|
@@ -172096,7 +173040,7 @@ ${node.id}`;
|
|
|
172096
173040
|
from,
|
|
172097
173041
|
to,
|
|
172098
173042
|
kind,
|
|
172099
|
-
label: this.flowPayloadText(fm) ?? typeText(m) ?? transferredFeature ??
|
|
173043
|
+
label: this.flowPayloadText(fm) ?? typeText(m) ?? transferredFeature ?? nameOf3(m),
|
|
172100
173044
|
source: sourceOf2(m, uri)
|
|
172101
173045
|
});
|
|
172102
173046
|
registerDrawn(m);
|
|
@@ -172155,7 +173099,7 @@ ${node.id}`;
|
|
|
172155
173099
|
if (anchorHostsFlow && anchorParts?.length) {
|
|
172156
173100
|
recordLaneCandidate(anchorId, true, void 0, anchorParts, anchorId);
|
|
172157
173101
|
}
|
|
172158
|
-
const identity6 = (part) => qnameOf(part) ||
|
|
173102
|
+
const identity6 = (part) => qnameOf(part) || nameOf3(part) || "?";
|
|
172159
173103
|
const projections = /* @__PURE__ */ new Map();
|
|
172160
173104
|
const projectionFor = (part, ordinal) => {
|
|
172161
173105
|
const id2 = identity6(part);
|
|
@@ -172229,7 +173173,7 @@ ${node.id}`;
|
|
|
172229
173173
|
return countDelta || (leftProjection?.ordinal ?? 0) - (rightProjection?.ordinal ?? 0) || identity6(left).localeCompare(identity6(right));
|
|
172230
173174
|
});
|
|
172231
173175
|
const partIds = orderedParts.map(identity6);
|
|
172232
|
-
const partNames = orderedParts.map((part) =>
|
|
173176
|
+
const partNames = orderedParts.map((part) => nameOf3(part) ?? relativeName(part));
|
|
172233
173177
|
const partSources = orderedParts.map((part) => sourceOf2(part, uri));
|
|
172234
173178
|
const memberIds = [...new Set(group.members.map((member) => member.id))];
|
|
172235
173179
|
const overlayParent = group.owner;
|
|
@@ -172256,7 +173200,7 @@ ${node.id}`;
|
|
|
172256
173200
|
// lane header, not the qualified
|
|
172257
173201
|
// `owner::lane` path. Existing nested performer claims retain the
|
|
172258
173202
|
// relative path that disambiguates same-named nested parts.
|
|
172259
|
-
label: memberIds.length === 0 ?
|
|
173203
|
+
label: memberIds.length === 0 ? nameOf3(orderedParts[0]) ?? relativeName(orderedParts[0]) : relativeName(orderedParts[0]),
|
|
172260
173204
|
keyword: "performer",
|
|
172261
173205
|
parent: overlayParent,
|
|
172262
173206
|
isDef: false,
|
|
@@ -172294,14 +173238,14 @@ ${node.id}`;
|
|
|
172294
173238
|
for (const [memberId, performerIds] of memberPerformers) {
|
|
172295
173239
|
const performerNames = [...performerIds].map((partId) => {
|
|
172296
173240
|
const projection2 = projections.get(partId);
|
|
172297
|
-
return projection2 ?
|
|
173241
|
+
return projection2 ? nameOf3(projection2.part) ?? relativeName(projection2.part) : partId;
|
|
172298
173242
|
});
|
|
172299
173243
|
const performerMemberships = [...performerIds].map((partId) => {
|
|
172300
173244
|
const projection2 = projections.get(partId);
|
|
172301
173245
|
const claimSources = projection2?.members.filter((member) => member.id === memberId).flatMap((member) => performerClaimsOf.get(member.occurrence)?.get(partId) ?? []) ?? [];
|
|
172302
173246
|
return {
|
|
172303
173247
|
id: partId,
|
|
172304
|
-
name: projection2 ?
|
|
173248
|
+
name: projection2 ? nameOf3(projection2.part) ?? relativeName(projection2.part) : partId,
|
|
172305
173249
|
partSource: projection2 ? sourceOf2(projection2.part, uri) : void 0,
|
|
172306
173250
|
claimSources
|
|
172307
173251
|
};
|
|
@@ -172331,7 +173275,7 @@ ${node.id}`;
|
|
|
172331
173275
|
const sends = actionRecords.filter((r) => r.m.$type === "SendNode" || r.m.$type === "ActionDecl" && r.m.sendKw === true);
|
|
172332
173276
|
const accepts = actionRecords.filter((r) => r.m.$type === "AcceptNode");
|
|
172333
173277
|
const nodeIdOf = (m) => actionRecords.find((r) => r.m === m)?.id;
|
|
172334
|
-
const semanticIdentity = (node) => node ? qnameOf(node) ||
|
|
173278
|
+
const semanticIdentity = (node) => node ? qnameOf(node) || nameOf3(node) : void 0;
|
|
172335
173279
|
const resolvedPropertyTarget = (node, property3) => this.featurePaths.resolvePropertyPath(node, property3).segments.at(-1)?.target;
|
|
172336
173280
|
const payloadTypeIdentity = (send) => {
|
|
172337
173281
|
const payload = send.payload;
|
|
@@ -172391,7 +173335,7 @@ ${node.id}`;
|
|
|
172391
173335
|
return acceptVia === target;
|
|
172392
173336
|
return a2.m === target || a2.m.$container === target;
|
|
172393
173337
|
}
|
|
172394
|
-
return !!a2.performer && (qnameOf(a2.performer) === targetText ||
|
|
173338
|
+
return !!a2.performer && (qnameOf(a2.performer) === targetText || nameOf3(a2.performer) === lastSeg(targetText));
|
|
172395
173339
|
});
|
|
172396
173340
|
}
|
|
172397
173341
|
const match = candidates.length === 1 ? candidates[0] : void 0;
|
|
@@ -172449,12 +173393,12 @@ ${node.id}`;
|
|
|
172449
173393
|
const def = this.resolveType(holder, index2);
|
|
172450
173394
|
return def && def !== holder && def.isDef === true ? def : void 0;
|
|
172451
173395
|
};
|
|
172452
|
-
const ownStates = (holder) => membersOf(holder).map((member) => this.thenActionMemberNode(member) ?? member).filter((member) => isStateDecl(member) &&
|
|
173396
|
+
const ownStates = (holder) => membersOf(holder).map((member) => this.thenActionMemberNode(member) ?? member).filter((member) => isStateDecl(member) && nameOf3(member) !== void 0);
|
|
172453
173397
|
const nestedStates = (holder) => {
|
|
172454
173398
|
const out = ownStates(holder).map((node) => ({ node, borrowed: false }));
|
|
172455
173399
|
const def = definitionOf(holder);
|
|
172456
173400
|
for (const inherited of def ? ownStates(def) : []) {
|
|
172457
|
-
if (!out.some((m) =>
|
|
173401
|
+
if (!out.some((m) => nameOf3(m.node) === nameOf3(inherited))) {
|
|
172458
173402
|
out.push({ node: inherited, borrowed: true });
|
|
172459
173403
|
}
|
|
172460
173404
|
}
|
|
@@ -172464,11 +173408,11 @@ ${node.id}`;
|
|
|
172464
173408
|
const nodes = [];
|
|
172465
173409
|
const frames = [];
|
|
172466
173410
|
const byName = /* @__PURE__ */ new Map();
|
|
172467
|
-
const anchorFrameId = (isStateDecl(anchor) || isExhibitStateDecl(anchor)) && topStates.length > 0 ? qnameOf(anchor) ||
|
|
173411
|
+
const anchorFrameId = (isStateDecl(anchor) || isExhibitStateDecl(anchor)) && topStates.length > 0 ? qnameOf(anchor) || nameOf3(anchor) || "__state_anchor__" : void 0;
|
|
172468
173412
|
if (anchorFrameId) {
|
|
172469
173413
|
frames.push({
|
|
172470
173414
|
id: anchorFrameId,
|
|
172471
|
-
label:
|
|
173415
|
+
label: nameOf3(anchor) ?? lastSeg(anchorFrameId),
|
|
172472
173416
|
keyword: keywordFor(anchor),
|
|
172473
173417
|
isDef: anchor.isDef === true,
|
|
172474
173418
|
type: typeText(anchor),
|
|
@@ -172507,11 +173451,11 @@ ${node.id}`;
|
|
|
172507
173451
|
return created;
|
|
172508
173452
|
};
|
|
172509
173453
|
const scopedId = (scope2, name) => `${scope2}::${name}`;
|
|
172510
|
-
const machineScopeId = anchorFrameId ?? qnameOf(anchor) ??
|
|
173454
|
+
const machineScopeId = anchorFrameId ?? qnameOf(anchor) ?? nameOf3(anchor) ?? "__stv__";
|
|
172511
173455
|
const renderState = (s, parentFrame, depth, seen, scope2, borrowed) => {
|
|
172512
|
-
const id2 = borrowed ? scopedId(scope2,
|
|
172513
|
-
byName.set(
|
|
172514
|
-
namesIn(parentFrame).set(
|
|
173456
|
+
const id2 = borrowed ? scopedId(scope2, nameOf3(s)) : qnameOf(s) || nameOf3(s);
|
|
173457
|
+
byName.set(nameOf3(s), id2);
|
|
173458
|
+
namesIn(parentFrame).set(nameOf3(s), id2);
|
|
172515
173459
|
registerDrawn(s);
|
|
172516
173460
|
drawnStates.push({ node: s, id: id2 });
|
|
172517
173461
|
idByState.set(s, id2);
|
|
@@ -172522,7 +173466,7 @@ ${node.id}`;
|
|
|
172522
173466
|
if (subStates.length) {
|
|
172523
173467
|
frames.push({
|
|
172524
173468
|
id: id2,
|
|
172525
|
-
label:
|
|
173469
|
+
label: nameOf3(s),
|
|
172526
173470
|
keyword: keywordFor(s),
|
|
172527
173471
|
parent: parentFrame,
|
|
172528
173472
|
isDef: s.isDef === true,
|
|
@@ -172537,7 +173481,7 @@ ${node.id}`;
|
|
|
172537
173481
|
} else {
|
|
172538
173482
|
nodes.push({
|
|
172539
173483
|
id: id2,
|
|
172540
|
-
name:
|
|
173484
|
+
name: nameOf3(s),
|
|
172541
173485
|
keyword: keywordFor(s),
|
|
172542
173486
|
isDef: s.isDef === true,
|
|
172543
173487
|
shape: "state",
|
|
@@ -172555,11 +173499,11 @@ ${node.id}`;
|
|
|
172555
173499
|
const controlNodeInfo = (m) => {
|
|
172556
173500
|
switch (m.$type) {
|
|
172557
173501
|
case "ActionDecl":
|
|
172558
|
-
return m.isDef === true || !
|
|
173502
|
+
return m.isDef === true || !nameOf3(m) ? void 0 : { shape: "action", label: nameOf3(m) };
|
|
172559
173503
|
// A `perform` names the action it performs, which for a feature
|
|
172560
173504
|
// chain (`perform machine.selfTest;`) is the LAST segment.
|
|
172561
173505
|
case "PerformStmt": {
|
|
172562
|
-
const segments = [
|
|
173506
|
+
const segments = [nameOf3(m), ...m.chainSegs ?? []].filter((segment) => !!segment);
|
|
172563
173507
|
return { shape: "action", label: segments.at(-1) ?? typeText(m) ?? "perform" };
|
|
172564
173508
|
}
|
|
172565
173509
|
// User direction 2026-08-30: fork and join only. They express
|
|
@@ -172573,9 +173517,9 @@ ${node.id}`;
|
|
|
172573
173517
|
// so no succession can reach it and it could only ever stand
|
|
172574
173518
|
// alone. All three remain in the OMG 8.2.3.18 node set.
|
|
172575
173519
|
case "JoinNode":
|
|
172576
|
-
return { shape: "join", label:
|
|
173520
|
+
return { shape: "join", label: nameOf3(m) ?? "" };
|
|
172577
173521
|
case "ForkNode":
|
|
172578
|
-
return { shape: "fork", label:
|
|
173522
|
+
return { shape: "fork", label: nameOf3(m) ?? "" };
|
|
172579
173523
|
default:
|
|
172580
173524
|
return void 0;
|
|
172581
173525
|
}
|
|
@@ -172596,7 +173540,7 @@ ${node.id}`;
|
|
|
172596
173540
|
const info = controlNodeInfo(member);
|
|
172597
173541
|
if (!info)
|
|
172598
173542
|
continue;
|
|
172599
|
-
const name =
|
|
173543
|
+
const name = nameOf3(member);
|
|
172600
173544
|
if (name && drawnHere.has(name))
|
|
172601
173545
|
continue;
|
|
172602
173546
|
const id2 = name ? borrowed ? scopedId(frameId, name) : qnameOf(member) || scopedId(frameId, name) : `${frameId}::__stv_${member.$type}_${anonymousNodes++}__`;
|
|
@@ -172736,7 +173680,7 @@ ${node.id}`;
|
|
|
172736
173680
|
}
|
|
172737
173681
|
}
|
|
172738
173682
|
const anchorDefinition = definitionOf(anchor);
|
|
172739
|
-
const firstStateId = designatedInitial(anchor, anchorFrameId) ?? (anchorDefinition ? designatedInitial(anchorDefinition, anchorFrameId) : void 0) ?? (topStates.length ? namesIn(anchorFrameId).get(
|
|
173683
|
+
const firstStateId = designatedInitial(anchor, anchorFrameId) ?? (anchorDefinition ? designatedInitial(anchorDefinition, anchorFrameId) : void 0) ?? (topStates.length ? namesIn(anchorFrameId).get(nameOf3(topStates[0].node)) ?? byName.get(nameOf3(topStates[0].node)) : void 0);
|
|
172740
173684
|
if (firstStateId)
|
|
172741
173685
|
link("__initial__", firstStateId, void 0, void 0);
|
|
172742
173686
|
const compositeInitial = /* @__PURE__ */ new Map();
|
|
@@ -172780,7 +173724,7 @@ ${node.id}`;
|
|
|
172780
173724
|
}
|
|
172781
173725
|
const sequentialTransitions = (holder, initialId, frameId) => {
|
|
172782
173726
|
let cursor;
|
|
172783
|
-
const idOf = (member) => machineNodeIdIn(frameId, member) ?? (
|
|
173727
|
+
const idOf = (member) => machineNodeIdIn(frameId, member) ?? (nameOf3(member) ? resolveEndpoint(nameOf3(member), void 0, frameId) : void 0) ?? idByState.get(member);
|
|
172784
173728
|
const endpoint = (path10) => resolveEndpoint(path10, initialId, frameId);
|
|
172785
173729
|
for (const member of membersOf(holder)) {
|
|
172786
173730
|
switch (member.$type) {
|
|
@@ -172903,10 +173847,10 @@ ${node.id}`;
|
|
|
172903
173847
|
if (!targetNode && !targetFrame)
|
|
172904
173848
|
continue;
|
|
172905
173849
|
const primary = claims[0].part;
|
|
172906
|
-
const partIds = claims.map(({ part }) => qnameOf(part) ||
|
|
172907
|
-
const partNames = claims.map(({ part }) =>
|
|
173850
|
+
const partIds = claims.map(({ part }) => qnameOf(part) || nameOf3(part) || "?");
|
|
173851
|
+
const partNames = claims.map(({ part }) => nameOf3(part) ?? lastSeg(qnameOf(part) || "?"));
|
|
172908
173852
|
const partSources = claims.map(({ part }) => sourceOf2(part, uri));
|
|
172909
|
-
const frameId = `__stv_exhibitor_${exhibitBoundary++}__${qnameOf(primary) ||
|
|
173853
|
+
const frameId = `__stv_exhibitor_${exhibitBoundary++}__${qnameOf(primary) || nameOf3(primary) || "part"}`;
|
|
172910
173854
|
const oldParent = targetNode?.frame ?? targetFrame?.parent;
|
|
172911
173855
|
frames.push({
|
|
172912
173856
|
id: frameId,
|
|
@@ -172922,13 +173866,13 @@ ${node.id}`;
|
|
|
172922
173866
|
exhibitorPartNames: partNames,
|
|
172923
173867
|
exhibitorPartSources: partSources,
|
|
172924
173868
|
exhibitorClaims: claims.map(({ part, claim }) => ({
|
|
172925
|
-
partId: qnameOf(part) ||
|
|
172926
|
-
partName:
|
|
173869
|
+
partId: qnameOf(part) || nameOf3(part) || "?",
|
|
173870
|
+
partName: nameOf3(part) ?? lastSeg(qnameOf(part) || "?"),
|
|
172927
173871
|
source: sourceOf2(claim, uri),
|
|
172928
173872
|
declaresState: !this.referencesBehavior(claim)
|
|
172929
173873
|
})),
|
|
172930
|
-
declarationId: qnameOf(primary) ||
|
|
172931
|
-
declarationName:
|
|
173874
|
+
declarationId: qnameOf(primary) || nameOf3(primary),
|
|
173875
|
+
declarationName: nameOf3(primary),
|
|
172932
173876
|
declarationSource: sourceOf2(primary, uri),
|
|
172933
173877
|
auxId: frameId
|
|
172934
173878
|
}
|
|
@@ -173009,9 +173953,9 @@ ${node.id}`;
|
|
|
173009
173953
|
const lifelineIds = /* @__PURE__ */ new Map();
|
|
173010
173954
|
const byName = /* @__PURE__ */ new Map();
|
|
173011
173955
|
for (const p of parts) {
|
|
173012
|
-
const id2 = qnameOf(p) ||
|
|
173956
|
+
const id2 = qnameOf(p) || nameOf3(p);
|
|
173013
173957
|
lifelineIds.set(p, id2);
|
|
173014
|
-
byName.set(
|
|
173958
|
+
byName.set(nameOf3(p), id2);
|
|
173015
173959
|
}
|
|
173016
173960
|
const evKey = (lifeline, event) => `${lifeline}\0${event}`;
|
|
173017
173961
|
const eventChains = /* @__PURE__ */ new Map();
|
|
@@ -173020,8 +173964,8 @@ ${node.id}`;
|
|
|
173020
173964
|
const chain = [];
|
|
173021
173965
|
for (const m of membersOf(p)) {
|
|
173022
173966
|
const ev = m.$type === "EventDecl" ? m : m.$type === "ThenActionMember" ? m.event : void 0;
|
|
173023
|
-
if (ev && ev.$type === "EventDecl" &&
|
|
173024
|
-
chain.push(evKey(id2,
|
|
173967
|
+
if (ev && ev.$type === "EventDecl" && nameOf3(ev))
|
|
173968
|
+
chain.push(evKey(id2, nameOf3(ev)));
|
|
173025
173969
|
}
|
|
173026
173970
|
if (chain.length)
|
|
173027
173971
|
eventChains.set(id2, chain);
|
|
@@ -173040,7 +173984,7 @@ ${node.id}`;
|
|
|
173040
173984
|
const from = resolveLifeline(ends.source);
|
|
173041
173985
|
const to = resolveLifeline(ends.target);
|
|
173042
173986
|
if (from && to) {
|
|
173043
|
-
const nm =
|
|
173987
|
+
const nm = nameOf3(m);
|
|
173044
173988
|
const t = this.flowPayloadText(m) ?? typeText(m);
|
|
173045
173989
|
const label = nm && t ? `${nm} of ${t}` : nm ?? t;
|
|
173046
173990
|
const reply = nm?.toLowerCase().startsWith("reply") ?? false;
|
|
@@ -173163,7 +174107,7 @@ ${node.id}`;
|
|
|
173163
174107
|
const events = (eventChains.get(id2) ?? []).filter((k) => !rootHasMsg.has(find3(k))).map((k) => ({ name: k.split("\0")[1], slot: slotOf.get(find3(k)) ?? 0 }));
|
|
173164
174108
|
nodes.push({
|
|
173165
174109
|
id: id2,
|
|
173166
|
-
name:
|
|
174110
|
+
name: nameOf3(p),
|
|
173167
174111
|
keyword: keywordFor(p),
|
|
173168
174112
|
isDef: false,
|
|
173169
174113
|
shape: "lifeline",
|
|
@@ -173246,7 +174190,7 @@ ${node.id}`;
|
|
|
173246
174190
|
const scope = this.packageScopeOf(anchor);
|
|
173247
174191
|
const scopeContents = [...ast_utils_exports.streamAllContents(scope)];
|
|
173248
174192
|
let cases = scopeContents.filter(this.isCaseUsage);
|
|
173249
|
-
let caseDefs = scopeContents.filter((n2) => this.isCaseLike(n2) && n2.isDef === true &&
|
|
174193
|
+
let caseDefs = scopeContents.filter((n2) => this.isCaseLike(n2) && n2.isDef === true && nameOf3(n2));
|
|
173250
174194
|
if (!isPackage(anchor) && !isDocument(anchor)) {
|
|
173251
174195
|
const related = this.relatedNodes(anchor, ctx.index);
|
|
173252
174196
|
cases = cases.filter((c) => related.has(c));
|
|
@@ -173268,11 +174212,11 @@ ${node.id}`;
|
|
|
173268
174212
|
};
|
|
173269
174213
|
const displayedCases = [.../* @__PURE__ */ new Set([...cases, ...caseDefs])];
|
|
173270
174214
|
const nodes = [];
|
|
173271
|
-
const scopeId = qnameOf(scope) ||
|
|
174215
|
+
const scopeId = qnameOf(scope) || nameOf3(scope) || "__document__";
|
|
173272
174216
|
const idOf = /* @__PURE__ */ new Map();
|
|
173273
174217
|
const add = (n2, shape, extra) => {
|
|
173274
174218
|
const { id: explicitId, ...rest } = extra ?? {};
|
|
173275
|
-
const id2 = explicitId ?? (qnameOf(n2) ||
|
|
174219
|
+
const id2 = explicitId ?? (qnameOf(n2) || nameOf3(n2) || `n${nodes.length}`);
|
|
173276
174220
|
idOf.set(n2, id2);
|
|
173277
174221
|
nodes.push({
|
|
173278
174222
|
id: id2,
|
|
@@ -173392,7 +174336,7 @@ ${node.id}`;
|
|
|
173392
174336
|
}
|
|
173393
174337
|
}
|
|
173394
174338
|
}
|
|
173395
|
-
const denotesSubject = (s) => !!(
|
|
174339
|
+
const denotesSubject = (s) => !!(nameOf3(s) || typeText(s) || subjectValuePath(s));
|
|
173396
174340
|
for (const c of displayedCases) {
|
|
173397
174341
|
const declared = declaredMembers(c).filter(isSubjectDecl);
|
|
173398
174342
|
const s = declared.find(denotesSubject) ?? declared[0];
|
|
@@ -173408,7 +174352,7 @@ ${node.id}`;
|
|
|
173408
174352
|
meta: { cvCase: true, ...subjectOfCase.has(c) ? { subject: subjectOfCase.get(c) } : {} }
|
|
173409
174353
|
}));
|
|
173410
174354
|
for (const d of caseDefs) {
|
|
173411
|
-
if (idOf.has(d) || !(qnameOf(d) ||
|
|
174355
|
+
if (idOf.has(d) || !(qnameOf(d) || nameOf3(d)))
|
|
173412
174356
|
continue;
|
|
173413
174357
|
add(d, "box", {
|
|
173414
174358
|
compartments: this.compartmentsFor(d, uri, index2),
|
|
@@ -173475,7 +174419,7 @@ ${node.id}`;
|
|
|
173475
174419
|
const typeSources = siblings.some((a2) => !actorTypeKey(a2)) ? [...siblings, ...this.inheritedTypesOf(c, index2).flatMap((t) => membersOf(t).filter(isActorDecl))] : siblings;
|
|
173476
174420
|
for (const a2 of siblings) {
|
|
173477
174421
|
const actorId = addActor(a2, typeSources);
|
|
173478
|
-
const pair = `${actorId}\0${qnameOf(c) ??
|
|
174422
|
+
const pair = `${actorId}\0${qnameOf(c) ?? nameOf3(c) ?? ""}`;
|
|
173479
174423
|
if (!actorCasePairs.has(pair)) {
|
|
173480
174424
|
actorCasePairs.add(pair);
|
|
173481
174425
|
actorOfCase.push([actorId, c]);
|
|
@@ -173486,16 +174430,16 @@ ${node.id}`;
|
|
|
173486
174430
|
const usageByName = /* @__PURE__ */ new Map();
|
|
173487
174431
|
const definitionByName = /* @__PURE__ */ new Map();
|
|
173488
174432
|
for (const d of caseDefs) {
|
|
173489
|
-
const dn =
|
|
174433
|
+
const dn = nameOf3(d);
|
|
173490
174434
|
if (dn && !definitionByName.has(dn))
|
|
173491
174435
|
definitionByName.set(dn, d);
|
|
173492
174436
|
}
|
|
173493
174437
|
for (const c of cases) {
|
|
173494
174438
|
const def = caseDefOf(c);
|
|
173495
|
-
const dn = def ?
|
|
174439
|
+
const dn = def ? nameOf3(def) : void 0;
|
|
173496
174440
|
if (dn && !usageByDefName.has(dn))
|
|
173497
174441
|
usageByDefName.set(dn, c);
|
|
173498
|
-
const un =
|
|
174442
|
+
const un = nameOf3(c);
|
|
173499
174443
|
if (un)
|
|
173500
174444
|
usageByName.set(un, c);
|
|
173501
174445
|
}
|
|
@@ -173576,19 +174520,19 @@ ${node.id}`;
|
|
|
173576
174520
|
const { uri, index: index2 } = ctx;
|
|
173577
174521
|
const scope = this.packageScopeOf(ctx.anchor);
|
|
173578
174522
|
const all = [...ast_utils_exports.streamAllContents(scope)];
|
|
173579
|
-
const reqs = all.filter((n2) => isRequirementDecl(n2) &&
|
|
174523
|
+
const reqs = all.filter((n2) => isRequirementDecl(n2) && nameOf3(n2));
|
|
173580
174524
|
const subjectKeyOf = (req) => {
|
|
173581
174525
|
const subject = membersOf(req).find((m) => m.$type === "SubjectDecl");
|
|
173582
|
-
return (subject ? typeText(subject) ??
|
|
174526
|
+
return (subject ? typeText(subject) ?? nameOf3(subject) ?? "" : "") || "\uFFFF";
|
|
173583
174527
|
};
|
|
173584
|
-
reqs.sort((a2, b) => subjectKeyOf(a2).localeCompare(subjectKeyOf(b)) || (
|
|
174528
|
+
reqs.sort((a2, b) => subjectKeyOf(a2).localeCompare(subjectKeyOf(b)) || (nameOf3(a2) ?? "").localeCompare(nameOf3(b) ?? ""));
|
|
173585
174529
|
const satisfies = all.filter((n2) => n2.$type === "SatisfyStmt");
|
|
173586
174530
|
const verifies = all.filter((n2) => n2.$type === "VerifyStmt");
|
|
173587
|
-
const reqAttrs = (req) => membersOf(req).filter((m) => isAttributeDecl(m) && m.isDef !== true &&
|
|
174531
|
+
const reqAttrs = (req) => membersOf(req).filter((m) => isAttributeDecl(m) && m.isDef !== true && nameOf3(m));
|
|
173588
174532
|
const attrColumns = [];
|
|
173589
174533
|
for (const req of reqs) {
|
|
173590
174534
|
for (const a2 of reqAttrs(req)) {
|
|
173591
|
-
const an =
|
|
174535
|
+
const an = nameOf3(a2);
|
|
173592
174536
|
if (!attrColumns.includes(an))
|
|
173593
174537
|
attrColumns.push(an);
|
|
173594
174538
|
}
|
|
@@ -173599,14 +174543,14 @@ ${node.id}`;
|
|
|
173599
174543
|
return t.length >= 2 && (t[0] === '"' && t.endsWith('"') || t[0] === "'" && t.endsWith("'")) ? t.slice(1, -1).trim() : t;
|
|
173600
174544
|
};
|
|
173601
174545
|
const reqIdOf = (req) => {
|
|
173602
|
-
const idAttr = membersOf(req).find((m) => isAttributeDecl(m) && m.isDef !== true && (
|
|
174546
|
+
const idAttr = membersOf(req).find((m) => isAttributeDecl(m) && m.isDef !== true && (nameOf3(m) === "reqId" || (m.relationships ?? []).some((r) => (r.targets ?? []).some((t) => lastSeg(t) === "reqId"))));
|
|
173603
174547
|
const attrVal = idAttr ? stripQuotes2(attrValueText(idAttr)) : "";
|
|
173604
174548
|
if (attrVal)
|
|
173605
174549
|
return attrVal;
|
|
173606
174550
|
const sn = req.shortName?.name;
|
|
173607
174551
|
return sn ? stripQuotes2(sn) : "";
|
|
173608
174552
|
};
|
|
173609
|
-
const rowIdOf = (req) => qnameOf(req) ||
|
|
174553
|
+
const rowIdOf = (req) => qnameOf(req) || nameOf3(req);
|
|
173610
174554
|
const reqSet = new Set(reqs);
|
|
173611
174555
|
const parentReqOf = (req) => {
|
|
173612
174556
|
let cur = req.$container;
|
|
@@ -173640,7 +174584,7 @@ ${node.id}`;
|
|
|
173640
174584
|
for (const root4 of roots)
|
|
173641
174585
|
visit(root4, 0, void 0);
|
|
173642
174586
|
const rows = ordered.map(({ req, depth, parentId }) => {
|
|
173643
|
-
const name =
|
|
174587
|
+
const name = nameOf3(req);
|
|
173644
174588
|
const qname = qnameOf(req) || name;
|
|
173645
174589
|
const docMember = membersOf(req).find((m) => m.$type === "DocCommentMember");
|
|
173646
174590
|
const docText = docMember ? docCommentBody(docMember) ?? "" : "";
|
|
@@ -173651,12 +174595,12 @@ ${node.id}`;
|
|
|
173651
174595
|
const reqSatisfies = satisfies.filter((s) => pathMatchesQName(String(s.target ?? ""), qname));
|
|
173652
174596
|
const reqVerifies = verifies.filter((v) => pathMatchesQName(String(v.target ?? ""), qname));
|
|
173653
174597
|
const satPills = reqSatisfies.map((s) => ({
|
|
173654
|
-
text: bindingName(s.by) ??
|
|
174598
|
+
text: bindingName(s.by) ?? nameOf3(this.enclosingUsage(s) ?? s) ?? "?",
|
|
173655
174599
|
kind: "satisfy",
|
|
173656
174600
|
source: sourceOf2(s, uri)
|
|
173657
174601
|
}));
|
|
173658
174602
|
const verPills = reqVerifies.map((v) => ({
|
|
173659
|
-
text:
|
|
174603
|
+
text: nameOf3(this.enclosingCase(v) ?? v) ?? "?",
|
|
173660
174604
|
kind: "verify",
|
|
173661
174605
|
source: sourceOf2(v, uri)
|
|
173662
174606
|
}));
|
|
@@ -173672,7 +174616,7 @@ ${node.id}`;
|
|
|
173672
174616
|
}
|
|
173673
174617
|
const ownAttrs = reqAttrs(req);
|
|
173674
174618
|
const attrCells = attrColumns.map((an) => {
|
|
173675
|
-
const a2 = ownAttrs.find((x) =>
|
|
174619
|
+
const a2 = ownAttrs.find((x) => nameOf3(x) === an);
|
|
173676
174620
|
const v = a2 ? attrValueText(a2) : "";
|
|
173677
174621
|
return { text: v, accent: "yellow", edit: { kind: "attribute", name: an, value: v } };
|
|
173678
174622
|
});
|
|
@@ -173712,10 +174656,10 @@ ${node.id}`;
|
|
|
173712
174656
|
buildTabularGrid(ctx) {
|
|
173713
174657
|
const { uri } = ctx;
|
|
173714
174658
|
const scope = this.packageScopeOf(ctx.anchor);
|
|
173715
|
-
const elems = [...ast_utils_exports.streamAllContents(scope)].filter((n2) => isDefinitionKind(n2) &&
|
|
173716
|
-
elems.sort((a2, b) => keywordFor(a2).localeCompare(keywordFor(b)) || (
|
|
174659
|
+
const elems = [...ast_utils_exports.streamAllContents(scope)].filter((n2) => isDefinitionKind(n2) && nameOf3(n2));
|
|
174660
|
+
elems.sort((a2, b) => keywordFor(a2).localeCompare(keywordFor(b)) || (nameOf3(a2) ?? "").localeCompare(nameOf3(b) ?? ""));
|
|
173717
174661
|
const rows = elems.map((n2) => {
|
|
173718
|
-
const name =
|
|
174662
|
+
const name = nameOf3(n2);
|
|
173719
174663
|
const usageFields = n2.isDef !== true;
|
|
173720
174664
|
const docMember = membersOf(n2).find((m) => m.$type === "DocCommentMember");
|
|
173721
174665
|
const docText = docMember ? docCommentBody(docMember) ?? "" : "";
|
|
@@ -173743,12 +174687,12 @@ ${node.id}`;
|
|
|
173743
174687
|
const scope = this.packageScopeOf(ctx.anchor);
|
|
173744
174688
|
const valued = [...ast_utils_exports.streamAllContents(scope)].filter((n2) => {
|
|
173745
174689
|
const vn = n2;
|
|
173746
|
-
return
|
|
174690
|
+
return nameOf3(n2) && vn.isDef !== true && (isAttributeDecl(n2) || vn.value !== void 0 || vn.default !== void 0);
|
|
173747
174691
|
});
|
|
173748
174692
|
const ownerName = (n2) => {
|
|
173749
174693
|
for (let c = n2.$container; c; c = c.$container)
|
|
173750
|
-
if (
|
|
173751
|
-
return
|
|
174694
|
+
if (nameOf3(c))
|
|
174695
|
+
return nameOf3(c);
|
|
173752
174696
|
return "";
|
|
173753
174697
|
};
|
|
173754
174698
|
const valueText = (n2) => {
|
|
@@ -173756,7 +174700,7 @@ ${node.id}`;
|
|
|
173756
174700
|
return (nn.value?.$cstNode?.text ?? nn.default?.value?.$cstNode?.text ?? "").replace(/\s+/g, " ").trim();
|
|
173757
174701
|
};
|
|
173758
174702
|
const rows = valued.map((n2) => {
|
|
173759
|
-
const name =
|
|
174703
|
+
const name = nameOf3(n2);
|
|
173760
174704
|
const cells = [
|
|
173761
174705
|
{ text: name, accent: "violet", edit: { kind: "name", value: name } },
|
|
173762
174706
|
{ text: typeText(n2) ?? "", edit: { kind: "type", value: typeText(n2) ?? "" } },
|
|
@@ -173793,7 +174737,7 @@ ${node.id}`;
|
|
|
173793
174737
|
return;
|
|
173794
174738
|
const owner = this.enclosingUsage(m) ?? m.$container;
|
|
173795
174739
|
const bound = bindingName(mn.by);
|
|
173796
|
-
push2(bound ?? (owner ? qnameOf(owner) ||
|
|
174740
|
+
push2(bound ?? (owner ? qnameOf(owner) || nameOf3(owner) : void 0), mn.target, m);
|
|
173797
174741
|
return;
|
|
173798
174742
|
}
|
|
173799
174743
|
case "flow": {
|
|
@@ -173868,7 +174812,7 @@ ${node.id}`;
|
|
|
173868
174812
|
const bySimple = /* @__PURE__ */ new Map();
|
|
173869
174813
|
const visit = (m) => {
|
|
173870
174814
|
if (m.$type !== "ImportSeg") {
|
|
173871
|
-
const name =
|
|
174815
|
+
const name = nameOf3(m);
|
|
173872
174816
|
const qname = name ? qnameOf(m) : "";
|
|
173873
174817
|
if (name && qname) {
|
|
173874
174818
|
byQName.set(qname, m);
|
|
@@ -173914,7 +174858,7 @@ ${node.id}`;
|
|
|
173914
174858
|
const elem = byQName.get(f);
|
|
173915
174859
|
return {
|
|
173916
174860
|
id: f,
|
|
173917
|
-
name: elem ?
|
|
174861
|
+
name: elem ? nameOf3(elem) : void 0,
|
|
173918
174862
|
keyword: elem ? keywordFor(elem) : void 0,
|
|
173919
174863
|
cells,
|
|
173920
174864
|
source: src ? sourceOf2(src, uri) : void 0
|
|
@@ -173939,7 +174883,7 @@ ${node.id}`;
|
|
|
173939
174883
|
if (depth > 12)
|
|
173940
174884
|
return;
|
|
173941
174885
|
for (const m of membersOf(node)) {
|
|
173942
|
-
const nm =
|
|
174886
|
+
const nm = nameOf3(m);
|
|
173943
174887
|
if (!nm) {
|
|
173944
174888
|
visit(m, parentId, depth + 1);
|
|
173945
174889
|
continue;
|
|
@@ -174091,7 +175035,7 @@ ${node.id}`;
|
|
|
174091
175035
|
// with every unpositioned part in the tree.
|
|
174092
175036
|
collectGeometry(anchor, index2) {
|
|
174093
175037
|
const out = [];
|
|
174094
|
-
const base = qnameOf(anchor) ||
|
|
175038
|
+
const base = qnameOf(anchor) || nameOf3(anchor) || "";
|
|
174095
175039
|
const frames = /* @__PURE__ */ new Map();
|
|
174096
175040
|
const anchorFrame = this.ownFrameOf(anchor, index2);
|
|
174097
175041
|
if (anchorFrame)
|
|
@@ -174107,7 +175051,7 @@ ${node.id}`;
|
|
|
174107
175051
|
continue;
|
|
174108
175052
|
if (!isPartDecl(child) && !isItemDecl(child))
|
|
174109
175053
|
continue;
|
|
174110
|
-
const name =
|
|
175054
|
+
const name = nameOf3(child);
|
|
174111
175055
|
if (!name)
|
|
174112
175056
|
continue;
|
|
174113
175057
|
const local = this.localPlacementOf(child, index2);
|
|
@@ -174572,7 +175516,7 @@ ${node.id}`;
|
|
|
174572
175516
|
let def = this.resolveType(node, index2);
|
|
174573
175517
|
let guard = 0;
|
|
174574
175518
|
while (def && guard++ < 12) {
|
|
174575
|
-
const dn =
|
|
175519
|
+
const dn = nameOf3(def);
|
|
174576
175520
|
if (dn) {
|
|
174577
175521
|
const k = _SysmlDiagramModelProvider.SHAPE_TYPES[dn.toLowerCase()];
|
|
174578
175522
|
if (k)
|
|
@@ -174649,7 +175593,7 @@ ${node.id}`;
|
|
|
174649
175593
|
// Whether an attribute member's effective names (its own name plus any
|
|
174650
175594
|
// `:>>`/`:>`/redefines/subsets target) intersect the wanted set.
|
|
174651
175595
|
attrMatches(m, want) {
|
|
174652
|
-
const nm =
|
|
175596
|
+
const nm = nameOf3(m);
|
|
174653
175597
|
if (nm && want.has(nm.toLowerCase()))
|
|
174654
175598
|
return true;
|
|
174655
175599
|
const short = m.shortName?.name;
|
|
@@ -174679,8 +175623,8 @@ ${node.id}`;
|
|
|
174679
175623
|
return {
|
|
174680
175624
|
kind,
|
|
174681
175625
|
root: {
|
|
174682
|
-
id: qnameOf(anchor) ||
|
|
174683
|
-
name:
|
|
175626
|
+
id: qnameOf(anchor) || nameOf3(anchor) || "",
|
|
175627
|
+
name: nameOf3(anchor) ?? (isPackage(anchor) ? "package" : ""),
|
|
174684
175628
|
qname: qnameOf(anchor),
|
|
174685
175629
|
// REQ-173 — the frame header states the ANCHORING ELEMENT's
|
|
174686
175630
|
// keyword. A view opened on a package (a package overview, a
|
|
@@ -174787,7 +175731,7 @@ ${node.id}`;
|
|
|
174787
175731
|
ownerDecl(node) {
|
|
174788
175732
|
let cur = node;
|
|
174789
175733
|
while (cur) {
|
|
174790
|
-
if (
|
|
175734
|
+
if (nameOf3(cur) && (isDefinitionKind(cur) || isPackage(cur)))
|
|
174791
175735
|
return cur;
|
|
174792
175736
|
cur = cur.$container;
|
|
174793
175737
|
}
|
|
@@ -174942,7 +175886,7 @@ ${node.id}`;
|
|
|
174942
175886
|
enclosingLifeline(node, byName) {
|
|
174943
175887
|
let cur = node.$container;
|
|
174944
175888
|
while (cur) {
|
|
174945
|
-
const nm =
|
|
175889
|
+
const nm = nameOf3(cur);
|
|
174946
175890
|
if (nm && byName.has(nm))
|
|
174947
175891
|
return byName.get(nm);
|
|
174948
175892
|
cur = cur.$container;
|
|
@@ -175015,12 +175959,12 @@ ${node.id}`;
|
|
|
175015
175959
|
// projection origin to choose a direct edit or a usage-local
|
|
175016
175960
|
// `port :>> name { ... }` materialization.
|
|
175017
175961
|
meta: {
|
|
175018
|
-
declarationId:
|
|
175962
|
+
declarationId: nameOf3(portNode) ? qnameOf(portNode) || portId : portId,
|
|
175019
175963
|
declarationName: pn,
|
|
175020
175964
|
inheritedFromType,
|
|
175021
|
-
localDeclaration: !inheritedFromType && !!
|
|
175965
|
+
localDeclaration: !inheritedFromType && !!nameOf3(portNode) && !!localUsage && isAstDescendantOrSelf(portNode, localUsage),
|
|
175022
175966
|
definitionId: portTypeDef ? qnameOf(portTypeDef) : void 0,
|
|
175023
|
-
definitionName: portTypeDef ?
|
|
175967
|
+
definitionName: portTypeDef ? nameOf3(portTypeDef) : void 0,
|
|
175024
175968
|
definitionSource: portTypeDef ? sourceOf2(portTypeDef, uri) : void 0,
|
|
175025
175969
|
...(() => {
|
|
175026
175970
|
const syncDeclaration = this.synchronizationDeclarationOf(portNode, index2);
|
|
@@ -175149,11 +176093,11 @@ ${node.id}`;
|
|
|
175149
176093
|
const segs = sourcePath.split(".");
|
|
175150
176094
|
if (segs.length < 2)
|
|
175151
176095
|
return void 0;
|
|
175152
|
-
const part = parts.find((p) =>
|
|
176096
|
+
const part = parts.find((p) => nameOf3(p) === segs[0]);
|
|
175153
176097
|
if (!part)
|
|
175154
176098
|
return void 0;
|
|
175155
176099
|
const typeDef = this.resolveType(part, index2);
|
|
175156
|
-
const portNode = typeDef ? membersOf(typeDef).find((m) => isPortDecl(m) &&
|
|
176100
|
+
const portNode = typeDef ? membersOf(typeDef).find((m) => isPortDecl(m) && nameOf3(m) === segs[segs.length - 1]) : void 0;
|
|
175157
176101
|
const portTypeDef = portNode ? this.resolveType(portNode, index2) : void 0;
|
|
175158
176102
|
if (!portTypeDef)
|
|
175159
176103
|
return void 0;
|
|
@@ -175177,11 +176121,11 @@ ${node.id}`;
|
|
|
175177
176121
|
const dir = directionOf(m);
|
|
175178
176122
|
const conj = isConjugated(m) ? "~" : "";
|
|
175179
176123
|
const t = typeText(m) ?? this.effectiveEnumerationTypeText(m);
|
|
175180
|
-
return `${dir ? `${dir} ` : ""}${derived}${
|
|
176124
|
+
return `${dir ? `${dir} ` : ""}${derived}${nameOf3(m) ?? ""}${t ? ` : ${conj}${t}` : ""}`.trim();
|
|
175181
176125
|
}
|
|
175182
176126
|
effectiveEnumerationTypeText(node) {
|
|
175183
176127
|
const type = this.effectiveEnumerationType(node);
|
|
175184
|
-
return type ?
|
|
176128
|
+
return type ? nameOf3(type) : void 0;
|
|
175185
176129
|
}
|
|
175186
176130
|
effectiveEnumerationType(node) {
|
|
175187
176131
|
if (!isEnumerationUsage(node))
|
|
@@ -175222,7 +176166,7 @@ ${node.id}`;
|
|
|
175222
176166
|
const isOrdinaryMember = (m) => directionOf(m) === void 0 && isNonVariantMember(m);
|
|
175223
176167
|
const inherited = includeInherited ? this.inheritedItems(node, index2, uri) : [];
|
|
175224
176168
|
const inheritedRows = (predicate, text = (member) => this.featureText(member)) => inherited.filter(({ member }) => predicate(member)).map(({ member, source }) => ({ text: `^${text(member)}`, source }));
|
|
175225
|
-
const usages = (guard) => members.filter((m) => guard(m) && m.isDef !== true &&
|
|
176169
|
+
const usages = (guard) => members.filter((m) => guard(m) && m.isDef !== true && nameOf3(m) && isOrdinaryMember(m));
|
|
175226
176170
|
const exprText4 = (m) => (m.body?.$cstNode?.text ?? "").replace(/\s+/g, " ").trim();
|
|
175227
176171
|
const statementText = (m) => (m.$cstNode?.text ?? this.featureText(m)).replace(/\s+/g, " ").replace(/;$/, "").trim();
|
|
175228
176172
|
const canonicalFeatureText = (m) => m.$type === "FeatureShorthand" || m.$type === "FeatureRedefinitionShorthand" ? statementText(m) : this.featureText(m);
|
|
@@ -175272,7 +176216,7 @@ ${node.id}`;
|
|
|
175272
176216
|
const undirected = (guard) => usages(guard);
|
|
175273
176217
|
add("items", undirected(isItemDecl).filter(notPortion).map((m) => item(m)));
|
|
175274
176218
|
add("occurrences", undirected(isOccurrenceDecl).filter(notPortion).map((m) => item(m)));
|
|
175275
|
-
add("occurrences", members.map((m) => this.thenActionMemberNode(m) ?? m).filter(isNonVariantMember).filter((m) => isEventDecl(m) && m.isOccurrence === true &&
|
|
176219
|
+
add("occurrences", members.map((m) => this.thenActionMemberNode(m) ?? m).filter(isNonVariantMember).filter((m) => isEventDecl(m) && m.isOccurrence === true && nameOf3(m)).map((m) => item(m)));
|
|
175276
176220
|
add("calcs", undirected(isCalcDecl).map((m) => item(m)));
|
|
175277
176221
|
add("constraints", undirected(isConstraintDecl).map((m) => item(m)));
|
|
175278
176222
|
add("assume constraints", members.filter((m) => m.$type === "AssumeConstraintStmt").map((m) => item(m, exprText4(m) || "assume constraint")));
|
|
@@ -175281,7 +176225,7 @@ ${node.id}`;
|
|
|
175281
176225
|
add("stakeholders", members.filter(isStakeholderDecl).filter(isNonVariantMember).map((m) => item(m)));
|
|
175282
176226
|
add("frames", members.filter((m) => m.$type === "FrameMember").map((m) => item(m, this.refText(m.target) ?? "concern")));
|
|
175283
176227
|
add("include use cases", members.filter((m) => m.$type === "IncludeStmt").map((m) => item(m, this.refText(m.target) ?? "")));
|
|
175284
|
-
add("objective", members.filter(isObjectiveDecl).filter(isNonVariantMember).map((m) => item(m,
|
|
176228
|
+
add("objective", members.filter(isObjectiveDecl).filter(isNonVariantMember).map((m) => item(m, nameOf3(m) ?? "objective")));
|
|
175285
176229
|
add("verifies", members.filter((m) => m.$type === "VerifyStmt").map((m) => item(m, String(m.target ?? ""))));
|
|
175286
176230
|
add("verification methods", members.filter((m) => isMetadataDecl(m) && (typeText(m) ?? "").includes("VerificationMethod")).map((m) => item(m, typeText(m) ?? "method")));
|
|
175287
176231
|
const behavioralParameterOwner = ["AssertConstraintStmt", "AssumeConstraintStmt", "RequireConstraintStmt"].includes(node.$type) || isActionDecl(node) || isCalcDecl(node) || isConstraintDecl(node) || isCaseDecl(node) || isAnalysisCaseDecl(node) || isVerificationCaseDecl(node) || isUseCaseDecl(node);
|
|
@@ -175300,12 +176244,12 @@ ${node.id}`;
|
|
|
175300
176244
|
})();
|
|
175301
176245
|
const directedTitle = behavioralParameterOwner || enclosingBehavioralParameterOwner ? "parameters" : "directed features";
|
|
175302
176246
|
add(directedTitle, [
|
|
175303
|
-
...members.filter((m) => directionOf(m) !== void 0 &&
|
|
176247
|
+
...members.filter((m) => directionOf(m) !== void 0 && nameOf3(m)).filter((m) => !isVariantMember(m) && !isVariantConfigMember(m)).map((m) => item(m, canonicalFeatureText(m))),
|
|
175304
176248
|
...inheritedRows((member) => directionOf(member) !== void 0 && isNonVariantMember(member))
|
|
175305
176249
|
]);
|
|
175306
176250
|
const calculationResult = isCalcDecl(node) ? effectiveCalculationResult(node, (name) => index2?.get(name)) : void 0;
|
|
175307
176251
|
const results = calculationResult?.parameter ? [calculationResult.parameter] : members.filter((m) => m.$type === "ReturnDecl");
|
|
175308
|
-
add("result", results.map((m) => item(m, `${calculationResult?.inherited ? "^" : ""}return${
|
|
176252
|
+
add("result", results.map((m) => item(m, `${calculationResult?.inherited ? "^" : ""}return${nameOf3(m) ? ` ${nameOf3(m)}` : ""}${typeText(m) ? ` : ${typeText(m)}` : ""}${valueTextOf(m) ? ` = ${valueTextOf(m)}` : ""}`)));
|
|
175309
176253
|
if (calculationResult?.expression)
|
|
175310
176254
|
add("expression", [{
|
|
175311
176255
|
text: calculationResult.expression.$cstNode?.text ?? "",
|
|
@@ -175316,7 +176260,7 @@ ${node.id}`;
|
|
|
175316
176260
|
}
|
|
175317
176261
|
const enumValueMembers = isEnumDecl(node) ? members.filter(isOwnedEnumerationValue) : members.filter((m) => isNonVariantMember(m) && m.$type === "EnumValueDecl" && !m.typing);
|
|
175318
176262
|
add("enums", enumValueMembers.map((m) => {
|
|
175319
|
-
const nm =
|
|
176263
|
+
const nm = nameOf3(m);
|
|
175320
176264
|
if (nm)
|
|
175321
176265
|
return item(m, nm);
|
|
175322
176266
|
const val = (m.value?.$cstNode?.text ?? "").replace(/\s+/g, " ").trim();
|
|
@@ -175335,17 +176279,17 @@ ${node.id}`;
|
|
|
175335
176279
|
DoAction: "during",
|
|
175336
176280
|
ExitAction: "exit"
|
|
175337
176281
|
};
|
|
175338
|
-
const stateActionText = (m) =>
|
|
176282
|
+
const stateActionText = (m) => nameOf3(m) ?? (m.$cstNode?.text ?? "").replace(/\s+/g, " ").replace(/;$/, "").replace(/^(entry|do|exit)\s+(action\s+)?/, "").trim();
|
|
175339
176283
|
for (const title of ["entry", "during", "exit"]) {
|
|
175340
176284
|
add(title, members.filter((m, at) => stateActionTitle[m.$type] === title && !isInitialStateMarker(m, at)).map((m) => item(m, stateActionText(m))).filter((row) => !!row.text));
|
|
175341
176285
|
}
|
|
175342
176286
|
add("state transition", members.filter((m) => m.$type === "TransitionDecl").map((m) => item(m, `${m.from ?? ""} \u2192 ${m.to ?? ""}`)));
|
|
175343
176287
|
const successionText = (m) => (m.$cstNode?.text ?? "").replace(/\s+/g, " ").replace(/;$/, "").trim();
|
|
175344
176288
|
add("successions", members.filter((m) => m.$type === "FirstThenChain" || m.$type === "SuccessionStmt" || m.$type === "ThenActionMember" && typeof m.target === "string" || m.$type === "ElseSuccessionMember" || (m.$type === "AcceptNode" || m.$type === "IfActionNode") && typeof m.thenTarget === "string").map((m) => item(m, successionText(m))).filter((row) => !!row.text));
|
|
175345
|
-
add("assert constraints", members.filter((m) => m.$type === "AssertConstraintStmt").map((m) => item(m, exprText4(m) ||
|
|
176289
|
+
add("assert constraints", members.filter((m) => m.$type === "AssertConstraintStmt").map((m) => item(m, exprText4(m) || nameOf3(m) || "assert constraint")));
|
|
175346
176290
|
add("invariants", members.filter((m) => m.$type === "InvShorthand").map((m) => {
|
|
175347
176291
|
const inv = m;
|
|
175348
|
-
const head2 = `inv${inv.isNegated ? " false" : ""}${
|
|
176292
|
+
const head2 = `inv${inv.isNegated ? " false" : ""}${nameOf3(m) ? ` ${nameOf3(m)}` : ""}`;
|
|
175349
176293
|
const expr = exprText4(m);
|
|
175350
176294
|
return item(m, `${head2} { ${expr} }`.replace(/\s+/g, " ").trim());
|
|
175351
176295
|
}));
|
|
@@ -175355,7 +176299,7 @@ ${node.id}`;
|
|
|
175355
176299
|
if (this.isAnonymousBehaviorReference(m))
|
|
175356
176300
|
return referenced || this.featureText(m);
|
|
175357
176301
|
const declared = this.featureText(m);
|
|
175358
|
-
return referenced && referenced !==
|
|
176302
|
+
return referenced && referenced !== nameOf3(m) ? `${declared} references ${referenced}` : declared;
|
|
175359
176303
|
};
|
|
175360
176304
|
add("perform actions", members.filter((m) => m.$type === "PerformStmt").filter(isNonVariantMember).map((m) => item(m, performRowText(m))));
|
|
175361
176305
|
if (isActionFlowStep(node)) {
|
|
@@ -175363,7 +176307,7 @@ ${node.id}`;
|
|
|
175363
176307
|
const performerName = (part) => {
|
|
175364
176308
|
const qualified = qnameOf(part);
|
|
175365
176309
|
if (!qualified)
|
|
175366
|
-
return
|
|
176310
|
+
return nameOf3(part) ?? "?";
|
|
175367
176311
|
return scope && qualified.startsWith(`${scope}::`) ? qualified.slice(scope.length + 2) : qualified;
|
|
175368
176312
|
};
|
|
175369
176313
|
const claims = this.performClaimsByTarget(this.documentRootOf(node), index2).get(node) ?? [];
|
|
@@ -175401,10 +176345,10 @@ ${node.id}`;
|
|
|
175401
176345
|
];
|
|
175402
176346
|
add("metadata", metaBadges.map((text) => ({ text })));
|
|
175403
176347
|
add("variants", [
|
|
175404
|
-
...members.filter((m) => isVariantMember(m) &&
|
|
175405
|
-
...inheritedRows((member) => isVariantMember(member) && !!
|
|
176348
|
+
...members.filter((m) => isVariantMember(m) && nameOf3(m)).map((m) => item(m)),
|
|
176349
|
+
...inheritedRows((member) => isVariantMember(member) && !!nameOf3(member))
|
|
175406
176350
|
]);
|
|
175407
|
-
const variantElementText = (member) => `${
|
|
176351
|
+
const variantElementText = (member) => `${nameOf3(member) ?? ""} = all ${(member.value?.$cstNode?.text ?? "").trim()}`.trim();
|
|
175408
176352
|
add("variant element usages", [
|
|
175409
176353
|
...members.filter(isVariantConfigMember).map((m) => item(m, variantElementText(m))),
|
|
175410
176354
|
...inheritedRows(isVariantConfigMember, variantElementText)
|
|
@@ -175423,10 +176367,10 @@ ${node.id}`;
|
|
|
175423
176367
|
const n2 = node;
|
|
175424
176368
|
const type = typeText(node);
|
|
175425
176369
|
const mult = this.multText(node);
|
|
175426
|
-
const name =
|
|
176370
|
+
const name = nameOf3(node) ?? ANONYMOUS_INTERFACE_NAME;
|
|
175427
176371
|
const head2 = `${name}${type ? ` : ${type}` : ""}${mult ? ` ${mult}` : ""}`;
|
|
175428
176372
|
const clause = n2.connect;
|
|
175429
|
-
const ends = clause?.ends?.length ? `connect (${clause.ends.map((end) => this.connectorEndPath(end) ?? "?").join(", ")})` : clause ? `connect ${this.connectorEndPath(clause.source) ?? "?"} to ${this.connectorEndPath(clause.target) ?? "?"}` : n2.target !== void 0 ? `${shorthandSourcePath(node) ?? [
|
|
176373
|
+
const ends = clause?.ends?.length ? `connect (${clause.ends.map((end) => this.connectorEndPath(end) ?? "?").join(", ")})` : clause ? `connect ${this.connectorEndPath(clause.source) ?? "?"} to ${this.connectorEndPath(clause.target) ?? "?"}` : n2.target !== void 0 ? `${shorthandSourcePath(node) ?? [nameOf3(node) ?? "", ...n2.srcSegs ?? []].filter(Boolean).join(".")} to ${this.featurePath(n2.target) ?? "?"}` : void 0;
|
|
175430
176374
|
if (ends && !clause)
|
|
175431
176375
|
return ends;
|
|
175432
176376
|
return [head2, ends].filter(Boolean).join(" ");
|
|
@@ -176267,8 +177211,8 @@ function outlineGroupForType(astType) {
|
|
|
176267
177211
|
}
|
|
176268
177212
|
|
|
176269
177213
|
// ../language-server/out/src/services/document-symbol-provider.js
|
|
176270
|
-
var
|
|
176271
|
-
var
|
|
177214
|
+
var SPECIALIZATION_KINDS7 = /* @__PURE__ */ new Set([":>", "specializes"]);
|
|
177215
|
+
var REDEFINITION_KINDS4 = /* @__PURE__ */ new Set([":>>", "redefines"]);
|
|
176272
177216
|
var INHERITABLE_FEATURE_TYPES = /* @__PURE__ */ new Set([
|
|
176273
177217
|
"ActionDecl",
|
|
176274
177218
|
"AttributeDecl",
|
|
@@ -176339,7 +177283,7 @@ function specializationTargets2(node) {
|
|
|
176339
177283
|
const n2 = node;
|
|
176340
177284
|
const out = [];
|
|
176341
177285
|
for (const rel2 of [...n2.preRelationships ?? [], ...n2.relationships ?? []]) {
|
|
176342
|
-
if (rel2.kind &&
|
|
177286
|
+
if (rel2.kind && SPECIALIZATION_KINDS7.has(rel2.kind))
|
|
176343
177287
|
out.push(...rel2.targets ?? []);
|
|
176344
177288
|
}
|
|
176345
177289
|
return out;
|
|
@@ -176348,7 +177292,7 @@ function redefinitionTargets(node) {
|
|
|
176348
177292
|
const n2 = node;
|
|
176349
177293
|
const out = [];
|
|
176350
177294
|
for (const rel2 of [...n2.preRelationships ?? [], ...n2.relationships ?? []]) {
|
|
176351
|
-
if (rel2.kind &&
|
|
177295
|
+
if (rel2.kind && REDEFINITION_KINDS4.has(rel2.kind))
|
|
176352
177296
|
out.push(...rel2.targets ?? []);
|
|
176353
177297
|
}
|
|
176354
177298
|
return out;
|
|
@@ -177851,6 +178795,29 @@ var DIAGNOSTIC_MESSAGES = {
|
|
|
177851
178795
|
// states what the definition may annotate; every explicit `about` target and
|
|
177852
178796
|
// the element an untargeted usage sits on bind that same feature.
|
|
177853
178797
|
SSM055_METADATA_TARGET_NOT_APPLICABLE: (target, targetKind, type, allowed) => `'${target}' is a '${targetKind}', but '${type}' annotates ${allowed}. Annotate an element of one of those kinds, or widen the definition's 'annotatedElement'.`,
|
|
178798
|
+
// issue #169 - a metadata definition that specializes 'SemanticMetadata'
|
|
178799
|
+
// says what the elements it annotates ARE (OMG SysML v2 Part 1 §7.27.4), and
|
|
178800
|
+
// 'baseType' is where it says it. Without a value it says nothing, and every
|
|
178801
|
+
// element tagged with it keeps the empty meaning the keyword was meant to fill.
|
|
178802
|
+
SSM056_SEMANTIC_BASE_TYPE_MISSING: (type) => `'${type}' specializes 'SemanticMetadata' but binds no 'baseType'. Bind one (for example ':>> baseType = parts meta SysML::PartUsage;'), or drop the 'SemanticMetadata' supertype.`,
|
|
178803
|
+
// issue #169 - the base type is a written path like any other, and one that
|
|
178804
|
+
// reaches nothing leaves every tagged element with no supertype at all.
|
|
178805
|
+
SSM057_SEMANTIC_BASE_TYPE_UNRESOLVED: (type, written) => `The 'baseType' of '${type}' names '${written}', which resolves to nothing. A semantic metadata base type must name a type this workspace can read.`,
|
|
178806
|
+
// issue #169 - 'SemanticMetadata::baseType' is declared 'Type[1]', so the
|
|
178807
|
+
// value has to BE a type. A package or a relationship is not one, and no
|
|
178808
|
+
// specialization can be made to it.
|
|
178809
|
+
SSM058_SEMANTIC_BASE_TYPE_NOT_A_TYPE: (type, written, kind) => `The 'baseType' of '${type}' names '${written}', which is a '${kind}'. A semantic metadata base type must be a definition or a usage.`,
|
|
178810
|
+
// issue #169 - 'baseType' is single-valued, so a definition and a supertype
|
|
178811
|
+
// that each bind a different one state a contradiction: which one a tagged
|
|
178812
|
+
// element specializes would depend on which is read first.
|
|
178813
|
+
SSM059_SEMANTIC_BASE_TYPE_CONFLICT: (type, first2, second) => `'${type}' states two base types ('${first2}' and '${second}'). 'SemanticMetadata::baseType' holds one type, so redefine it once in the most specific definition.`,
|
|
178814
|
+
// issue #169 - 'SemanticMetadata' redefines 'annotatedElement : Type[1]', so
|
|
178815
|
+
// a semantic tag on a package or an import states a specialization that
|
|
178816
|
+
// cannot exist.
|
|
178817
|
+
SSM060_SEMANTIC_TARGET_NOT_A_TYPE: (type, target, kind) => `'${type}' is semantic metadata, so it annotates a type. '${target}' is a '${kind}'. Tag a definition or a usage, or use a metadata definition that does not specialize 'SemanticMetadata'.`,
|
|
178818
|
+
// issue #169 - the implied specialization is a real edge, so it obeys the
|
|
178819
|
+
// same rule every written one does: a type cannot specialize itself.
|
|
178820
|
+
SSM061_SEMANTIC_BASE_TYPE_CYCLIC: (target, written) => `The implied specialization of '${target}' reaches '${written}', which specializes '${target}' again. Point the 'baseType' at a type outside this chain.`,
|
|
177854
178821
|
// REQ-392 — a `sysml-format` comment the formatter cannot act on. Advisory:
|
|
177855
178822
|
// the directive is inert, and saying so beats leaving the author to wonder
|
|
177856
178823
|
// why their layout was reformatted anyway.
|
|
@@ -178061,6 +179028,13 @@ var IMPLICIT_SPECIALIZATION_MESSAGES = {
|
|
|
178061
179028
|
subsets: "implicitly subsets",
|
|
178062
179029
|
source: " Source: the standard library, through the declaration keyword (OMG SysML v2 Part 1 section 7.6.8)."
|
|
178063
179030
|
};
|
|
179031
|
+
var SEMANTIC_METADATA_MESSAGES = {
|
|
179032
|
+
specializes: "implicitly specializes",
|
|
179033
|
+
definedBy: "is implicitly defined by",
|
|
179034
|
+
subsets: "implicitly subsets",
|
|
179035
|
+
source: (tag) => ` Source: the '${tag}' semantic metadata, through its 'baseType' (OMG SysML v2 Part 1 section 7.27.4).`,
|
|
179036
|
+
effectiveKind: (keyword, tag) => `*Effective kind:* \`${keyword}\`, from the '${tag}' semantic metadata.`
|
|
179037
|
+
};
|
|
178064
179038
|
|
|
178065
179039
|
// ../language-server/out/src/services/hover-provider.js
|
|
178066
179040
|
var MAX_HOVER_LINES = 30;
|
|
@@ -178924,6 +179898,11 @@ var SysmlHoverProvider = class {
|
|
|
178924
179898
|
linker;
|
|
178925
179899
|
/** REQ-411 — issue #161: the shared implicit-specialization model. */
|
|
178926
179900
|
implicit;
|
|
179901
|
+
/** issue #169 - the written paths a `baseType` is read through. */
|
|
179902
|
+
paths;
|
|
179903
|
+
/** issue #169 - one semantic-metadata model per parsed document root. */
|
|
179904
|
+
semanticModels = /* @__PURE__ */ new WeakMap();
|
|
179905
|
+
nameLookup;
|
|
178927
179906
|
constructor(services) {
|
|
178928
179907
|
this.references = services.references.References;
|
|
178929
179908
|
this.astNodeLocator = services.workspace.AstNodeLocator;
|
|
@@ -178931,10 +179910,43 @@ var SysmlHoverProvider = class {
|
|
|
178931
179910
|
this.indexManager = services.shared.workspace.IndexManager;
|
|
178932
179911
|
this.linker = services.references.Linker;
|
|
178933
179912
|
this.implicit = implicitSpecializationsFor(services.shared);
|
|
179913
|
+
this.nameLookup = nameLookupFor(services.shared);
|
|
178934
179914
|
const paths = new FeaturePathResolver(services);
|
|
179915
|
+
this.paths = paths;
|
|
178935
179916
|
this.featureProperties = featurePropertyResolver(paths);
|
|
178936
179917
|
this.enumerations = enumerationResolver(paths);
|
|
178937
179918
|
}
|
|
179919
|
+
/**
|
|
179920
|
+
* issue #169 - the semantic-metadata annotations of the document `node` is
|
|
179921
|
+
* in, built once per parsed root.
|
|
179922
|
+
*
|
|
179923
|
+
* A card is drawn one element at a time, so building the model per hover
|
|
179924
|
+
* would walk every keyword definition in the file for every tooltip. Keying
|
|
179925
|
+
* on the ROOT rather than the URI is what makes a rebuild produce a fresh
|
|
179926
|
+
* model: a new parse makes a new root, and the previous generation's
|
|
179927
|
+
* annotations are then unreachable.
|
|
179928
|
+
*/
|
|
179929
|
+
semanticModelFor(node) {
|
|
179930
|
+
const root4 = ast_utils_exports.findRootNode(node);
|
|
179931
|
+
if (!root4)
|
|
179932
|
+
return void 0;
|
|
179933
|
+
const cached = this.semanticModels.get(root4);
|
|
179934
|
+
if (cached)
|
|
179935
|
+
return cached;
|
|
179936
|
+
const lookup = this.nameLookup;
|
|
179937
|
+
if (!lookup)
|
|
179938
|
+
return void 0;
|
|
179939
|
+
const model = new SemanticMetadataModel(metadataNameResolver({
|
|
179940
|
+
visibleCandidates: (from, name) => this.paths.resolveVisibleNameCandidates(from, name),
|
|
179941
|
+
descriptionsFor: (name) => lookup.descriptions(name),
|
|
179942
|
+
nodeFor: (description) => description.node ?? this.linker.resolveIndexedNode?.(description)
|
|
179943
|
+
}), (usage, _text, occurrence) => {
|
|
179944
|
+
const candidates = this.paths.resolvePropertyPathCandidates(usage, "targets", occurrence);
|
|
179945
|
+
return candidates.length === 1 ? candidates[0] : void 0;
|
|
179946
|
+
}).build(root4);
|
|
179947
|
+
this.semanticModels.set(root4, model);
|
|
179948
|
+
return model;
|
|
179949
|
+
}
|
|
178938
179950
|
// REQ-246, REQ-334, REQ-335, REQ-336, REQ-342, REQ-343 — Route hover requests to markdown tooltip builders
|
|
178939
179951
|
async getHoverContent(document2, params) {
|
|
178940
179952
|
const rootCst = document2.parseResult?.value?.$cstNode;
|
|
@@ -179077,7 +180089,8 @@ var SysmlHoverProvider = class {
|
|
|
179077
180089
|
const rels = allRelationships2(named2);
|
|
179078
180090
|
const implied = this.implicit?.baseOf(node);
|
|
179079
180091
|
const impliedBase = implied && this.implicit?.descriptionOf(implied) ? implied : void 0;
|
|
179080
|
-
|
|
180092
|
+
const semantic = this.semanticMetadataLines(node);
|
|
180093
|
+
if (rels.length === 0 && !impliedBase && semantic.length === 0)
|
|
179081
180094
|
return void 0;
|
|
179082
180095
|
const sourceKind = kindLabel(node);
|
|
179083
180096
|
const sourceName = identificationLabel(named2) ?? "(anonymous)";
|
|
@@ -179103,9 +180116,42 @@ var SysmlHoverProvider = class {
|
|
|
179103
180116
|
const phrase = impliedBase.isUsage ? IMPLICIT_SPECIALIZATION_MESSAGES.subsets : IMPLICIT_SPECIALIZATION_MESSAGES.specializes;
|
|
179104
180117
|
lines.push(`- ${sourceKind} \`${sourceName}\` ${phrase} \`${impliedBase.qualified}\``, IMPLICIT_SPECIALIZATION_MESSAGES.source);
|
|
179105
180118
|
}
|
|
180119
|
+
lines.push(...semantic);
|
|
179106
180120
|
return lines.length > 0 ? `*Relationships:*
|
|
179107
180121
|
${lines.join("\n")}` : void 0;
|
|
179108
180122
|
}
|
|
180123
|
+
/**
|
|
180124
|
+
* issue #169 - the lines a semantic-metadata tag adds to a card: one per
|
|
180125
|
+
* edge it creates, and the effective kind a keywordless declaration gains.
|
|
180126
|
+
*
|
|
180127
|
+
* The edge is named with the tag rather than with the base alone, because
|
|
180128
|
+
* the tag is the only thing a reader sees at the declaration: `#subsystem`
|
|
180129
|
+
* says nothing about `subsystems` until the card says it does.
|
|
180130
|
+
*/
|
|
180131
|
+
// REQ-420 — SemanticMetadata and user-defined keyword specialization
|
|
180132
|
+
semanticMetadataLines(node) {
|
|
180133
|
+
const model = this.semanticModelFor(node);
|
|
180134
|
+
if (!model)
|
|
180135
|
+
return [];
|
|
180136
|
+
const annotations = model.annotationsOf(node);
|
|
180137
|
+
if (annotations.length === 0)
|
|
180138
|
+
return [];
|
|
180139
|
+
const sourceKind = kindLabel(node);
|
|
180140
|
+
const sourceName = identificationLabel(node) ?? "(anonymous)";
|
|
180141
|
+
const lines = [];
|
|
180142
|
+
for (const annotation of model.edgesOf(node)) {
|
|
180143
|
+
const tag = metadataTypeNamesOf(annotation.usage)[0] ?? "semantic metadata";
|
|
180144
|
+
const target = annotation.base?.node ? identificationLabel(annotation.base.node) ?? annotation.base.binding.written : annotation.base?.binding.written ?? "";
|
|
180145
|
+
const phrase = annotation.edge?.metaclass === "Specialization" ? SEMANTIC_METADATA_MESSAGES.specializes : annotation.edge?.metaclass === "FeatureTyping" ? SEMANTIC_METADATA_MESSAGES.definedBy : SEMANTIC_METADATA_MESSAGES.subsets;
|
|
180146
|
+
lines.push(`- ${sourceKind} \`${sourceName}\` ${phrase} \`${target}\``, SEMANTIC_METADATA_MESSAGES.source(tag));
|
|
180147
|
+
}
|
|
180148
|
+
const kind = effectiveKindOf(node, annotations);
|
|
180149
|
+
if (kind) {
|
|
180150
|
+
const tag = metadataTypeNamesOf(kind.from.usage)[0] ?? "semantic metadata";
|
|
180151
|
+
lines.push(SEMANTIC_METADATA_MESSAGES.effectiveKind(effectiveKeywordOf(kind), tag));
|
|
180152
|
+
}
|
|
180153
|
+
return lines;
|
|
180154
|
+
}
|
|
179109
180155
|
/**
|
|
179110
180156
|
* REQ-394 — Resolve a supertype for the documentation walk without pulling a
|
|
179111
180157
|
* document into the workspace.
|
|
@@ -180514,7 +181560,7 @@ var import_vscode_languageserver16 = __toESM(require_main4(), 1);
|
|
|
180514
181560
|
|
|
180515
181561
|
// ../language-server/out/src/services/metadata-filter.js
|
|
180516
181562
|
var INCONCLUSIVE2 = { kind: "inconclusive" };
|
|
180517
|
-
var
|
|
181563
|
+
var SPECIALIZATION_KINDS8 = /* @__PURE__ */ new Set([":>", "specializes", ":>>", "redefines", "subsets"]);
|
|
180518
181564
|
var MAX_SPECIALIZATION_DEPTH = 32;
|
|
180519
181565
|
var MAX_VALUE_DEPTH = 16;
|
|
180520
181566
|
function evaluateFilterCondition(condition, element, options) {
|
|
@@ -180617,7 +181663,7 @@ function declaresFeature2(node, name) {
|
|
|
180617
181663
|
if (node.name === name)
|
|
180618
181664
|
return true;
|
|
180619
181665
|
for (const rel2 of [...node.preRelationships ?? [], ...node.relationships ?? []]) {
|
|
180620
|
-
if (rel2.kind &&
|
|
181666
|
+
if (rel2.kind && SPECIALIZATION_KINDS8.has(rel2.kind) && (rel2.targets ?? []).includes(name))
|
|
180621
181667
|
return true;
|
|
180622
181668
|
}
|
|
180623
181669
|
return false;
|
|
@@ -180739,7 +181785,7 @@ function specializes(node, type, ctx, depth = 0, seen = /* @__PURE__ */ new Set(
|
|
|
180739
181785
|
function metaclassMatches(type, ctx) {
|
|
180740
181786
|
if (!ctx.element)
|
|
180741
181787
|
return false;
|
|
180742
|
-
const metaclass =
|
|
181788
|
+
const metaclass = effectiveMetaclassNameOf(ctx.element, ctx);
|
|
180743
181789
|
const written = type.$refText;
|
|
180744
181790
|
if (!written)
|
|
180745
181791
|
return false;
|
|
@@ -180748,6 +181794,34 @@ function metaclassMatches(type, ctx) {
|
|
|
180748
181794
|
const definition = ctx.options.resolveName?.(`SysML::${metaclass}`) ?? ctx.options.resolveName?.(metaclass);
|
|
180749
181795
|
return specializes(definition, type, ctx);
|
|
180750
181796
|
}
|
|
181797
|
+
function effectiveMetaclassNameOf(node, ctx) {
|
|
181798
|
+
if (!isKeywordlessDeclaration(node))
|
|
181799
|
+
return metaclassNameOf(node);
|
|
181800
|
+
const resolve8 = (name) => ctx.options.resolveName?.(name);
|
|
181801
|
+
const annotations = [];
|
|
181802
|
+
for (const usage of metadataUsagesAnnotating(node)) {
|
|
181803
|
+
const type = metadataTypeNodeOf(usage, resolve8);
|
|
181804
|
+
if (!type || !semanticMetadataVerdictOf(type, resolve8).isSemantic)
|
|
181805
|
+
continue;
|
|
181806
|
+
const reading = baseTypeBindingsOf(type, resolve8);
|
|
181807
|
+
const binding = reading.bindings[0];
|
|
181808
|
+
if (!binding)
|
|
181809
|
+
continue;
|
|
181810
|
+
annotations.push({
|
|
181811
|
+
usage,
|
|
181812
|
+
type,
|
|
181813
|
+
annotated: node,
|
|
181814
|
+
complete: reading.complete,
|
|
181815
|
+
bindings: reading.bindings,
|
|
181816
|
+
base: resolveSemanticBase(binding, resolve8)
|
|
181817
|
+
});
|
|
181818
|
+
}
|
|
181819
|
+
const kind = effectiveKindOf(node, annotations);
|
|
181820
|
+
if (!kind)
|
|
181821
|
+
return metaclassNameOf(node);
|
|
181822
|
+
const stem = kind.declType.endsWith("Decl") ? kind.declType.slice(0, -"Decl".length) : kind.declType;
|
|
181823
|
+
return `${stem}${kind.isDef ? "Definition" : "Usage"}`;
|
|
181824
|
+
}
|
|
180751
181825
|
function metaclassNameOf(node) {
|
|
180752
181826
|
if (isPackage(node))
|
|
180753
181827
|
return "Package";
|
|
@@ -180787,7 +181861,7 @@ function nameScope(ctx, depth = 0) {
|
|
|
180787
181861
|
function specializationTargets3(node) {
|
|
180788
181862
|
const targets = [];
|
|
180789
181863
|
for (const rel2 of [...node.preRelationships ?? [], ...node.relationships ?? []]) {
|
|
180790
|
-
if (rel2.kind &&
|
|
181864
|
+
if (rel2.kind && SPECIALIZATION_KINDS8.has(rel2.kind))
|
|
180791
181865
|
targets.push(...rel2.targets ?? []);
|
|
180792
181866
|
}
|
|
180793
181867
|
return targets;
|
|
@@ -181041,7 +182115,7 @@ function selectMemberships(path10, form, globalDescriptions) {
|
|
|
181041
182115
|
const index2 = GlobalDescriptionIndex.from(globalDescriptions);
|
|
181042
182116
|
const entries = [];
|
|
181043
182117
|
if (form.includesSelf) {
|
|
181044
|
-
const simple =
|
|
182118
|
+
const simple = simpleNameOf3(path10);
|
|
181045
182119
|
const self2 = index2.named(path10).find((desc) => form.importAll || !isPrivateDescription(desc));
|
|
181046
182120
|
if (self2)
|
|
181047
182121
|
entries.push({ name: simple, targetName: self2.name, description: self2 });
|
|
@@ -181060,7 +182134,7 @@ function selectMemberships(path10, form, globalDescriptions) {
|
|
|
181060
182134
|
}
|
|
181061
182135
|
return entries;
|
|
181062
182136
|
}
|
|
181063
|
-
function
|
|
182137
|
+
function simpleNameOf3(path10) {
|
|
181064
182138
|
return path10.includes("::") ? path10.slice(path10.lastIndexOf("::") + 2) : path10;
|
|
181065
182139
|
}
|
|
181066
182140
|
function isOwnedMembership(desc) {
|
|
@@ -181483,332 +182557,6 @@ function compositionProblemsOf(node, resolve8) {
|
|
|
181483
182557
|
return problems;
|
|
181484
182558
|
}
|
|
181485
182559
|
|
|
181486
|
-
// ../language-server/out/src/services/metadata-semantics.js
|
|
181487
|
-
var MAX_DEPTH = 32;
|
|
181488
|
-
var SPECIALIZATION_KINDS7 = /* @__PURE__ */ new Set([
|
|
181489
|
-
":>",
|
|
181490
|
-
"specializes",
|
|
181491
|
-
":>>",
|
|
181492
|
-
"redefines",
|
|
181493
|
-
"subsets"
|
|
181494
|
-
]);
|
|
181495
|
-
var REDEFINITION_KINDS4 = /* @__PURE__ */ new Set([":>>", "redefines"]);
|
|
181496
|
-
var STRUCTURAL_FEATURE_NAMES = /* @__PURE__ */ new Set(["self", "annotatedElement"]);
|
|
181497
|
-
var ANNOTATED_ELEMENT = "annotatedElement";
|
|
181498
|
-
function isMetadataUsage(node) {
|
|
181499
|
-
if (node.$type === "MetadataAnnotation")
|
|
181500
|
-
return true;
|
|
181501
|
-
return node.$type === "MetadataDecl" && node.isDef !== true;
|
|
181502
|
-
}
|
|
181503
|
-
function isMetadataPrefixTag(node) {
|
|
181504
|
-
return node.$type === "PrefixMetadataTag";
|
|
181505
|
-
}
|
|
181506
|
-
function metadataTypeNamesOf(node) {
|
|
181507
|
-
const usage = node;
|
|
181508
|
-
const names = [];
|
|
181509
|
-
const add = (text) => {
|
|
181510
|
-
const trimmed = text?.trim();
|
|
181511
|
-
if (trimmed)
|
|
181512
|
-
names.push(trimmed);
|
|
181513
|
-
};
|
|
181514
|
-
add((usage.type ?? usage.typing?.type)?.$refText);
|
|
181515
|
-
for (const more of usage.typing?.moreTypes ?? [])
|
|
181516
|
-
add(more.$refText);
|
|
181517
|
-
for (const typing of usage.moreTypings ?? []) {
|
|
181518
|
-
add(typing.type?.$refText);
|
|
181519
|
-
for (const more of typing.moreTypes ?? [])
|
|
181520
|
-
add(more.$refText);
|
|
181521
|
-
}
|
|
181522
|
-
return names;
|
|
181523
|
-
}
|
|
181524
|
-
function metadataTypeNodeOf(node, resolve8) {
|
|
181525
|
-
const usage = node;
|
|
181526
|
-
const reference = usage.type ?? usage.typing?.type;
|
|
181527
|
-
if (reference?.ref)
|
|
181528
|
-
return reference.ref;
|
|
181529
|
-
const written = reference?.$refText?.trim();
|
|
181530
|
-
return written ? resolve8(written, node) : void 0;
|
|
181531
|
-
}
|
|
181532
|
-
function metadataBindingsOf(node) {
|
|
181533
|
-
const bindings = [];
|
|
181534
|
-
for (const member of node.members ?? []) {
|
|
181535
|
-
if (NON_BINDING_MEMBER_TYPES.has(member.$type))
|
|
181536
|
-
continue;
|
|
181537
|
-
const redefined = redefinedNameOf2(member);
|
|
181538
|
-
if (redefined) {
|
|
181539
|
-
bindings.push({ name: redefined, form: "redefinition", node: member, value: member.value });
|
|
181540
|
-
continue;
|
|
181541
|
-
}
|
|
181542
|
-
if (member.name) {
|
|
181543
|
-
bindings.push({ name: member.name, form: "shorthand", node: member, value: member.value });
|
|
181544
|
-
}
|
|
181545
|
-
}
|
|
181546
|
-
return bindings;
|
|
181547
|
-
}
|
|
181548
|
-
var NON_BINDING_MEMBER_TYPES = /* @__PURE__ */ new Set([
|
|
181549
|
-
"DocCommentMember",
|
|
181550
|
-
"CommentStmt",
|
|
181551
|
-
"RepStmt",
|
|
181552
|
-
"MetadataAnnotation",
|
|
181553
|
-
"PrefixMetadataMember",
|
|
181554
|
-
"Import",
|
|
181555
|
-
"AliasDecl",
|
|
181556
|
-
"FilterMember"
|
|
181557
|
-
]);
|
|
181558
|
-
function redefinedNameOf2(member) {
|
|
181559
|
-
for (const relationship of [...member.preRelationships ?? [], ...member.relationships ?? []]) {
|
|
181560
|
-
if (!relationship.kind || !REDEFINITION_KINDS4.has(relationship.kind))
|
|
181561
|
-
continue;
|
|
181562
|
-
const target = (relationship.targets ?? [])[0];
|
|
181563
|
-
const simple = target?.split(/::|\./u).pop()?.trim();
|
|
181564
|
-
if (simple)
|
|
181565
|
-
return simple;
|
|
181566
|
-
}
|
|
181567
|
-
return void 0;
|
|
181568
|
-
}
|
|
181569
|
-
function metadataFeaturesOf(type, resolve8, implicitBaseNames = () => []) {
|
|
181570
|
-
const features = /* @__PURE__ */ new Map();
|
|
181571
|
-
const inherited = new Set(STRUCTURAL_FEATURE_NAMES);
|
|
181572
|
-
const seen = /* @__PURE__ */ new Set();
|
|
181573
|
-
let complete = true;
|
|
181574
|
-
const collectNames = (owner, depth, visited) => {
|
|
181575
|
-
if (!owner || depth > MAX_DEPTH || visited.has(owner))
|
|
181576
|
-
return;
|
|
181577
|
-
visited.add(owner);
|
|
181578
|
-
for (const member of owner.members ?? []) {
|
|
181579
|
-
const name = member.name ?? redefinedNameOf2(member);
|
|
181580
|
-
if (name)
|
|
181581
|
-
inherited.add(name);
|
|
181582
|
-
}
|
|
181583
|
-
for (const supertype of specializationTargetsOf2(owner)) {
|
|
181584
|
-
collectNames(resolve8(supertype, owner), depth + 1, visited);
|
|
181585
|
-
}
|
|
181586
|
-
};
|
|
181587
|
-
const walk = (owner, depth) => {
|
|
181588
|
-
if (!owner || depth > MAX_DEPTH || seen.has(owner)) {
|
|
181589
|
-
if (!owner)
|
|
181590
|
-
complete = false;
|
|
181591
|
-
return;
|
|
181592
|
-
}
|
|
181593
|
-
seen.add(owner);
|
|
181594
|
-
for (const base of implicitBaseNames(owner)) {
|
|
181595
|
-
collectNames(resolve8(base, owner), 0, /* @__PURE__ */ new Set());
|
|
181596
|
-
}
|
|
181597
|
-
for (const member of owner.members ?? []) {
|
|
181598
|
-
if (!isFeatureMember(member))
|
|
181599
|
-
continue;
|
|
181600
|
-
const name = member.name ?? redefinedNameOf2(member);
|
|
181601
|
-
if (!name)
|
|
181602
|
-
continue;
|
|
181603
|
-
const known2 = features.get(name);
|
|
181604
|
-
if (known2) {
|
|
181605
|
-
if (suppliedValueOf(member) !== void 0) {
|
|
181606
|
-
known2.hasDefault = true;
|
|
181607
|
-
known2.required = false;
|
|
181608
|
-
}
|
|
181609
|
-
continue;
|
|
181610
|
-
}
|
|
181611
|
-
features.set(name, {
|
|
181612
|
-
name,
|
|
181613
|
-
node: member,
|
|
181614
|
-
typeName: writtenTypeNameOf(member),
|
|
181615
|
-
hasDefault: suppliedValueOf(member) !== void 0,
|
|
181616
|
-
required: isRequiredFeature(member)
|
|
181617
|
-
});
|
|
181618
|
-
}
|
|
181619
|
-
for (const supertype of specializationTargetsOf2(owner)) {
|
|
181620
|
-
const resolved = resolve8(supertype, owner);
|
|
181621
|
-
if (!resolved) {
|
|
181622
|
-
complete = false;
|
|
181623
|
-
continue;
|
|
181624
|
-
}
|
|
181625
|
-
walk(resolved, depth + 1);
|
|
181626
|
-
}
|
|
181627
|
-
};
|
|
181628
|
-
if (!type)
|
|
181629
|
-
return { features: [], inherited, complete: false };
|
|
181630
|
-
walk(type, 0);
|
|
181631
|
-
return { features: [...features.values()], inherited, complete };
|
|
181632
|
-
}
|
|
181633
|
-
function isFeatureMember(member) {
|
|
181634
|
-
if (NON_BINDING_MEMBER_TYPES.has(member.$type))
|
|
181635
|
-
return false;
|
|
181636
|
-
if (member.$type === "MetadataDecl" && member.isDef === true)
|
|
181637
|
-
return false;
|
|
181638
|
-
return member.name !== void 0 || redefinedNameOf2(member) !== void 0;
|
|
181639
|
-
}
|
|
181640
|
-
function writtenTypeNameOf(member) {
|
|
181641
|
-
const written = member.typing?.type?.$refText?.trim();
|
|
181642
|
-
return written && written.length > 0 ? written : void 0;
|
|
181643
|
-
}
|
|
181644
|
-
function suppliedValueOf(member) {
|
|
181645
|
-
return member.value ?? member.default?.value;
|
|
181646
|
-
}
|
|
181647
|
-
function isRequiredFeature(member) {
|
|
181648
|
-
if (suppliedValueOf(member) !== void 0)
|
|
181649
|
-
return false;
|
|
181650
|
-
if ((member.modifiers ?? []).includes("abstract"))
|
|
181651
|
-
return false;
|
|
181652
|
-
if (STRUCTURAL_FEATURE_NAMES.has(member.name ?? ""))
|
|
181653
|
-
return false;
|
|
181654
|
-
if (STRUCTURAL_FEATURE_NAMES.has(redefinedNameOf2(member) ?? ""))
|
|
181655
|
-
return false;
|
|
181656
|
-
const lower2 = member.multiplicity?.lower;
|
|
181657
|
-
if (!lower2)
|
|
181658
|
-
return true;
|
|
181659
|
-
if (lower2.star === true)
|
|
181660
|
-
return false;
|
|
181661
|
-
if (lower2.intVal === void 0)
|
|
181662
|
-
return false;
|
|
181663
|
-
return lower2.intVal >= 1;
|
|
181664
|
-
}
|
|
181665
|
-
function annotatedElementRestrictionsOf(type, resolve8) {
|
|
181666
|
-
const restrictions = [];
|
|
181667
|
-
const seen = /* @__PURE__ */ new Set();
|
|
181668
|
-
const walk = (owner, depth) => {
|
|
181669
|
-
if (!owner || depth > MAX_DEPTH || seen.has(owner))
|
|
181670
|
-
return;
|
|
181671
|
-
seen.add(owner);
|
|
181672
|
-
for (const member of owner.members ?? []) {
|
|
181673
|
-
const binds = member.name === ANNOTATED_ELEMENT || redefinedNameOf2(member) === ANNOTATED_ELEMENT || subsetTargetsOf(member).includes(ANNOTATED_ELEMENT);
|
|
181674
|
-
if (!binds)
|
|
181675
|
-
continue;
|
|
181676
|
-
const typeName = writtenTypeNameOf(member);
|
|
181677
|
-
if (typeName) {
|
|
181678
|
-
restrictions.push({ typeName, node: member, owner, resolvedType: resolve8(typeName, member) });
|
|
181679
|
-
}
|
|
181680
|
-
}
|
|
181681
|
-
for (const supertype of specializationTargetsOf2(owner))
|
|
181682
|
-
walk(resolve8(supertype, owner), depth + 1);
|
|
181683
|
-
};
|
|
181684
|
-
walk(type, 0);
|
|
181685
|
-
return restrictions;
|
|
181686
|
-
}
|
|
181687
|
-
function subsetTargetsOf(member) {
|
|
181688
|
-
const targets = [];
|
|
181689
|
-
for (const relationship of [...member.preRelationships ?? [], ...member.relationships ?? []]) {
|
|
181690
|
-
if (relationship.kind !== ":>" && relationship.kind !== "subsets")
|
|
181691
|
-
continue;
|
|
181692
|
-
for (const target of relationship.targets ?? []) {
|
|
181693
|
-
const simple = target.split(/::|\./u).pop()?.trim();
|
|
181694
|
-
if (simple)
|
|
181695
|
-
targets.push(simple);
|
|
181696
|
-
}
|
|
181697
|
-
}
|
|
181698
|
-
return targets;
|
|
181699
|
-
}
|
|
181700
|
-
function metadataTargetsOf(node, resolve8) {
|
|
181701
|
-
const usage = node;
|
|
181702
|
-
const written = usage.targets ?? [];
|
|
181703
|
-
if (written.length > 0) {
|
|
181704
|
-
return written.map((text, occurrence) => ({
|
|
181705
|
-
text: text.trim(),
|
|
181706
|
-
node: resolve8(text.trim(), occurrence),
|
|
181707
|
-
explicit: true
|
|
181708
|
-
}));
|
|
181709
|
-
}
|
|
181710
|
-
const owner = annotatedOwnerOf(node);
|
|
181711
|
-
if (!owner)
|
|
181712
|
-
return [];
|
|
181713
|
-
return [{ text: owner.name ?? owner.$type, node: owner, explicit: false }];
|
|
181714
|
-
}
|
|
181715
|
-
function annotatedOwnerOf(node) {
|
|
181716
|
-
const container = node.$container;
|
|
181717
|
-
if (container?.$type === "PrefixMetadataMember") {
|
|
181718
|
-
return container.element;
|
|
181719
|
-
}
|
|
181720
|
-
if (!container)
|
|
181721
|
-
return void 0;
|
|
181722
|
-
if (!NON_ANNOTATED_CONTAINERS.has(container.$type))
|
|
181723
|
-
return container;
|
|
181724
|
-
if (node.$type !== "MetadataAnnotation")
|
|
181725
|
-
return void 0;
|
|
181726
|
-
return followingDeclarationOf(node, container);
|
|
181727
|
-
}
|
|
181728
|
-
function followingDeclarationOf(node, container) {
|
|
181729
|
-
const members = container.members ?? container.elements ?? [];
|
|
181730
|
-
const index2 = members.indexOf(node);
|
|
181731
|
-
if (index2 < 0)
|
|
181732
|
-
return void 0;
|
|
181733
|
-
for (let next = index2 + 1; next < members.length; next += 1) {
|
|
181734
|
-
const candidate = members[next];
|
|
181735
|
-
if (candidate.$type === "MetadataAnnotation")
|
|
181736
|
-
continue;
|
|
181737
|
-
return candidate;
|
|
181738
|
-
}
|
|
181739
|
-
return void 0;
|
|
181740
|
-
}
|
|
181741
|
-
var NON_ANNOTATED_CONTAINERS = /* @__PURE__ */ new Set(["Document", "Package", "NamespaceDecl"]);
|
|
181742
|
-
function valueEvaluability(value, resolve8) {
|
|
181743
|
-
if (!value)
|
|
181744
|
-
return "unknown";
|
|
181745
|
-
let verdict = "model-level";
|
|
181746
|
-
for (const node of [value, ...ast_utils_exports.streamAllContents(value)]) {
|
|
181747
|
-
if (node.$type !== "PathExpr")
|
|
181748
|
-
continue;
|
|
181749
|
-
const written = pathTextOf(node);
|
|
181750
|
-
if (!written)
|
|
181751
|
-
return "unknown";
|
|
181752
|
-
const segments = written.split(/::|\./u).map((segment) => segment.trim()).filter(Boolean);
|
|
181753
|
-
const root4 = segments.length > 0 ? resolve8(segments[0], node) : void 0;
|
|
181754
|
-
if (root4 && isOccurrenceUsage(root4))
|
|
181755
|
-
return "instance-level";
|
|
181756
|
-
if (segments.length > 1) {
|
|
181757
|
-
if (!root4)
|
|
181758
|
-
return "unknown";
|
|
181759
|
-
continue;
|
|
181760
|
-
}
|
|
181761
|
-
const target = resolve8(written, node);
|
|
181762
|
-
if (!target)
|
|
181763
|
-
return "unknown";
|
|
181764
|
-
if (referentEvaluability(target) === "unknown")
|
|
181765
|
-
verdict = "unknown";
|
|
181766
|
-
}
|
|
181767
|
-
return verdict;
|
|
181768
|
-
}
|
|
181769
|
-
function pathTextOf(node) {
|
|
181770
|
-
const text = node.$cstNode?.text?.trim();
|
|
181771
|
-
return text && text.length > 0 ? text : void 0;
|
|
181772
|
-
}
|
|
181773
|
-
function referentEvaluability(target) {
|
|
181774
|
-
if (isOwnedEnumerationValue(target))
|
|
181775
|
-
return "model-level";
|
|
181776
|
-
const node = target;
|
|
181777
|
-
if (node.isDef === true)
|
|
181778
|
-
return "model-level";
|
|
181779
|
-
if (node.value !== void 0)
|
|
181780
|
-
return "model-level";
|
|
181781
|
-
return isOccurrenceUsage(node) ? "instance-level" : "unknown";
|
|
181782
|
-
}
|
|
181783
|
-
function isOccurrenceUsage(node) {
|
|
181784
|
-
return node.isDef !== true && OCCURRENCE_USAGE_TYPES.has(node.$type);
|
|
181785
|
-
}
|
|
181786
|
-
var OCCURRENCE_USAGE_TYPES = /* @__PURE__ */ new Set([
|
|
181787
|
-
"PartDecl",
|
|
181788
|
-
"ItemDecl",
|
|
181789
|
-
"PortDecl",
|
|
181790
|
-
"ActionDecl",
|
|
181791
|
-
"StateDecl",
|
|
181792
|
-
"OccurrenceDecl",
|
|
181793
|
-
"ConnectionDecl",
|
|
181794
|
-
"InterfaceDecl",
|
|
181795
|
-
"AllocationDecl",
|
|
181796
|
-
"EventDecl"
|
|
181797
|
-
]);
|
|
181798
|
-
function specializationTargetsOf2(node) {
|
|
181799
|
-
const owner = node;
|
|
181800
|
-
const targets = [];
|
|
181801
|
-
for (const relationship of [...owner.preRelationships ?? [], ...owner.relationships ?? []]) {
|
|
181802
|
-
if (relationship.kind && SPECIALIZATION_KINDS7.has(relationship.kind)) {
|
|
181803
|
-
targets.push(...relationship.targets ?? []);
|
|
181804
|
-
}
|
|
181805
|
-
}
|
|
181806
|
-
const typed = owner.typing?.type?.$refText;
|
|
181807
|
-
if (typed)
|
|
181808
|
-
targets.push(typed);
|
|
181809
|
-
return targets.map((target) => target.trim()).filter((target) => target.length > 0);
|
|
181810
|
-
}
|
|
181811
|
-
|
|
181812
182560
|
// ../language-server/out/src/services/validator.js
|
|
181813
182561
|
var REDEFINITION_KINDS5 = /* @__PURE__ */ new Set([
|
|
181814
182562
|
":>>",
|
|
@@ -181904,7 +182652,7 @@ function maskNonCode(text) {
|
|
|
181904
182652
|
}
|
|
181905
182653
|
return out.join("");
|
|
181906
182654
|
}
|
|
181907
|
-
var
|
|
182655
|
+
var SPECIALIZATION_KINDS9 = /* @__PURE__ */ new Set([":>", ":>>", "specializes", "subsets", "redefines"]);
|
|
181908
182656
|
var CONSTRAINT_SIDE_EFFECT_TYPES = /* @__PURE__ */ new Set([
|
|
181909
182657
|
"AssignNode",
|
|
181910
182658
|
"SendNode",
|
|
@@ -182094,6 +182842,10 @@ var SysmlValidator = class _SysmlValidator {
|
|
|
182094
182842
|
// declaration without pulling its document into `LangiumDocuments`, so the
|
|
182095
182843
|
// metadata resolver goes through it rather than a second loader.
|
|
182096
182844
|
linker;
|
|
182845
|
+
// issue #169 - one semantic-metadata model per parsed document root. Keyed
|
|
182846
|
+
// on the root rather than the URI, so a rebuild (which makes a new root)
|
|
182847
|
+
// cannot be answered from the previous generation's annotations.
|
|
182848
|
+
semanticModels = /* @__PURE__ */ new WeakMap();
|
|
182097
182849
|
constructor(services) {
|
|
182098
182850
|
this.serviceRegistry = services.shared.ServiceRegistry;
|
|
182099
182851
|
this.linker = services.references.Linker;
|
|
@@ -183557,7 +184309,7 @@ ${baseIndent}}`;
|
|
|
183557
184309
|
accept(severity("SYN019", "error"), DIAGNOSTIC_MESSAGES.SYN019_ABSTRACT_VARIATION, { node: child, code: "SYN019" });
|
|
183558
184310
|
}
|
|
183559
184311
|
for (const relation of [...decl.preRelationships ?? [], ...decl.relationships ?? []]) {
|
|
183560
|
-
if (!relation.kind || !
|
|
184312
|
+
if (!relation.kind || !SPECIALIZATION_KINDS9.has(relation.kind))
|
|
183561
184313
|
continue;
|
|
183562
184314
|
for (let index2 = 0; index2 < (relation.targets?.length ?? 0); index2 += 1) {
|
|
183563
184315
|
const resolution = this.featurePaths.resolvePropertyPath(relation, "targets", index2);
|
|
@@ -183917,6 +184669,7 @@ ${baseIndent}}`;
|
|
|
183917
184669
|
const satisfyStmts = [];
|
|
183918
184670
|
const includeStmts = [];
|
|
183919
184671
|
const metadataUsages = [];
|
|
184672
|
+
const metadataDefinitions = [];
|
|
183920
184673
|
const aliasMap = /* @__PURE__ */ new Map();
|
|
183921
184674
|
for (const child of ast_utils_exports.streamAllContents(node)) {
|
|
183922
184675
|
if (isImport(child)) {
|
|
@@ -183944,6 +184697,8 @@ ${baseIndent}}`;
|
|
|
183944
184697
|
includeStmts.push(child);
|
|
183945
184698
|
if (isMetadataUsage(child) || isMetadataPrefixTag(child))
|
|
183946
184699
|
metadataUsages.push(child);
|
|
184700
|
+
if (isMetadataDefinition(child))
|
|
184701
|
+
metadataDefinitions.push(child);
|
|
183947
184702
|
}
|
|
183948
184703
|
this.checkAmbiguousReferences(node, imports, index2, accept);
|
|
183949
184704
|
this.checkPrivateImports(imports, index2, accept);
|
|
@@ -183979,7 +184734,7 @@ ${baseIndent}}`;
|
|
|
183979
184734
|
this.checkInverseOfTargets(decl, index2, accept);
|
|
183980
184735
|
this.checkTypeComposition(decl, index2, accept);
|
|
183981
184736
|
}
|
|
183982
|
-
this.checkTypeConformance(decls, satisfyStmts, includeStmts, metadataUsages, index2, accept);
|
|
184737
|
+
this.checkTypeConformance(node, decls, satisfyStmts, includeStmts, metadataUsages, metadataDefinitions, index2, accept);
|
|
183983
184738
|
}
|
|
183984
184739
|
// ══════════════════════════════════════════════════════════════════════
|
|
183985
184740
|
// REQ-390 — SSM017-SSM021: whole-model type conformance (issue #104)
|
|
@@ -183989,7 +184744,7 @@ ${baseIndent}}`;
|
|
|
183989
184744
|
// the walk, so a type rooted in the unparsed standard library yields
|
|
183990
184745
|
// `unknown` and no diagnostic. That is what keeps the OMG corpus clean while
|
|
183991
184746
|
// still catching the workspace-local mistakes these codes exist for.
|
|
183992
|
-
checkTypeConformance(decls, satisfyStmts, includeStmts, metadataUsages, index2, accept) {
|
|
184747
|
+
checkTypeConformance(root4, decls, satisfyStmts, includeStmts, metadataUsages, metadataDefinitions, index2, accept) {
|
|
183993
184748
|
const model = new ConformanceModel((name) => this.resolveUnique(name, index2), (node) => this.implicit?.closureOf(node) ?? { names: /* @__PURE__ */ new Set(), complete: true });
|
|
183994
184749
|
for (const decl of decls) {
|
|
183995
184750
|
this.checkRedefinitionTypeConformance(decl, model, index2, accept);
|
|
@@ -184013,6 +184768,94 @@ ${baseIndent}}`;
|
|
|
184013
184768
|
this.checkIncludeBindings(stmt, model, index2, accept);
|
|
184014
184769
|
if (metadataUsages.length > 0)
|
|
184015
184770
|
this.checkMetadataUsages(metadataUsages, index2, accept);
|
|
184771
|
+
if (metadataDefinitions.length > 0 || metadataUsages.length > 0) {
|
|
184772
|
+
this.checkSemanticMetadata(root4, metadataDefinitions, index2, accept);
|
|
184773
|
+
}
|
|
184774
|
+
}
|
|
184775
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
184776
|
+
// REQ-420 - SSM056-SSM061: SemanticMetadata and user-defined keywords
|
|
184777
|
+
// (issue #169)
|
|
184778
|
+
// ══════════════════════════════════════════════════════════════════════
|
|
184779
|
+
/**
|
|
184780
|
+
* REQ-420 - OMG SysML v2 Part 1 §7.27.4. A metadata definition that
|
|
184781
|
+
* specializes `SemanticMetadata` gives every element it annotates a base
|
|
184782
|
+
* type, and the tag becomes a user-defined keyword: `#subsystem engine;` IS
|
|
184783
|
+
* `part engine :> subsystems;`.
|
|
184784
|
+
*
|
|
184785
|
+
* Two groups of check, judged where each belongs. SSM056-SSM059 are about
|
|
184786
|
+
* the DEFINITION - it states no base type, one that cannot be read, one that
|
|
184787
|
+
* is not a type, or two that contradict each other - and are reported on the
|
|
184788
|
+
* definition, once, however many elements it tags. SSM060 and SSM061 are
|
|
184789
|
+
* about one ANNOTATION and are reported on it.
|
|
184790
|
+
*
|
|
184791
|
+
* Every one of them is three-valued like the rest of the family: a hierarchy
|
|
184792
|
+
* this workspace could not walk whole reports nothing, because the supertype
|
|
184793
|
+
* it could not read is exactly where the missing binding would have been.
|
|
184794
|
+
*/
|
|
184795
|
+
// REQ-420 — SemanticMetadata and user-defined keyword specialization
|
|
184796
|
+
checkSemanticMetadata(root4, definitions, index2, accept) {
|
|
184797
|
+
const resolve8 = (name, from) => this.resolveMetadataName(name, index2, from);
|
|
184798
|
+
for (const definition of definitions) {
|
|
184799
|
+
const verdict = semanticMetadataVerdictOf(definition, resolve8);
|
|
184800
|
+
if (!verdict.isSemantic || !verdict.complete)
|
|
184801
|
+
continue;
|
|
184802
|
+
const optional2 = statesOwnBaseTypeOptionally(definition);
|
|
184803
|
+
const reading = baseTypeBindingsOf(definition, resolve8);
|
|
184804
|
+
if (!reading.complete)
|
|
184805
|
+
continue;
|
|
184806
|
+
const name = definition.name ?? "this metadata definition";
|
|
184807
|
+
const [first2, second] = reading.bindings;
|
|
184808
|
+
if (!first2) {
|
|
184809
|
+
if (optional2)
|
|
184810
|
+
continue;
|
|
184811
|
+
accept(severity("SSM056", "error"), DIAGNOSTIC_MESSAGES.SSM056_SEMANTIC_BASE_TYPE_MISSING(name), { node: definition, code: "SSM056" });
|
|
184812
|
+
continue;
|
|
184813
|
+
}
|
|
184814
|
+
if (second && second.owner === first2.owner && second.written !== first2.written) {
|
|
184815
|
+
accept(severity("SSM059", "error"), DIAGNOSTIC_MESSAGES.SSM059_SEMANTIC_BASE_TYPE_CONFLICT(name, first2.written, second.written), { node: first2.node, code: "SSM059" });
|
|
184816
|
+
}
|
|
184817
|
+
const base = resolveSemanticBase(first2, resolve8);
|
|
184818
|
+
if (base.unresolved && !/::|\./u.test(first2.written)) {
|
|
184819
|
+
accept(severity("SSM057", "error"), DIAGNOSTIC_MESSAGES.SSM057_SEMANTIC_BASE_TYPE_UNRESOLVED(name, first2.written), { node: first2.node, code: "SSM057" });
|
|
184820
|
+
} else if (base.form === "not-a-type" && base.node) {
|
|
184821
|
+
accept(severity("SSM058", "error"), DIAGNOSTIC_MESSAGES.SSM058_SEMANTIC_BASE_TYPE_NOT_A_TYPE(name, first2.written, metaclassNameOf(base.node)), { node: first2.node, code: "SSM058" });
|
|
184822
|
+
}
|
|
184823
|
+
}
|
|
184824
|
+
const model = this.semanticMetadataModel(root4, index2);
|
|
184825
|
+
for (const element of model.annotatedElements()) {
|
|
184826
|
+
for (const annotation of model.annotationsOf(element)) {
|
|
184827
|
+
if (!annotation.complete || !annotation.base || annotation.base.unresolved)
|
|
184828
|
+
continue;
|
|
184829
|
+
const typeName = metadataTypeNamesOf(annotation.usage)[0] ?? "this metadata definition";
|
|
184830
|
+
const targetName = element.name ?? metaclassNameOf(element);
|
|
184831
|
+
if (semanticFormOf(element) === "not-a-type") {
|
|
184832
|
+
accept(severity("SSM060", "error"), DIAGNOSTIC_MESSAGES.SSM060_SEMANTIC_TARGET_NOT_A_TYPE(typeName, targetName, metaclassNameOf(element)), { node: annotation.usage, code: "SSM060" });
|
|
184833
|
+
continue;
|
|
184834
|
+
}
|
|
184835
|
+
if (annotation.edge && model.isCyclicBase(element, annotation.base)) {
|
|
184836
|
+
accept(severity("SSM061", "error"), DIAGNOSTIC_MESSAGES.SSM061_SEMANTIC_BASE_TYPE_CYCLIC(targetName, annotation.base.binding.written), { node: annotation.usage, code: "SSM061" });
|
|
184837
|
+
}
|
|
184838
|
+
}
|
|
184839
|
+
}
|
|
184840
|
+
}
|
|
184841
|
+
/**
|
|
184842
|
+
* REQ-420 - the document's semantic-metadata model, built once.
|
|
184843
|
+
*
|
|
184844
|
+
* Reading one annotation walks its definition's whole supertype hierarchy,
|
|
184845
|
+
* so a file that tags fifty parts with one keyword must not walk it fifty
|
|
184846
|
+
* times. The `about` targets go through the resolver that owns written paths
|
|
184847
|
+
* and knows the scope each usage sits in, exactly as `SSM055` reads them.
|
|
184848
|
+
*/
|
|
184849
|
+
semanticMetadataModel(root4, index2) {
|
|
184850
|
+
const cached = this.semanticModels.get(root4);
|
|
184851
|
+
if (cached)
|
|
184852
|
+
return cached;
|
|
184853
|
+
const model = new SemanticMetadataModel((name, from) => this.resolveMetadataName(name, index2, from), (usage, _text, occurrence) => {
|
|
184854
|
+
const candidates = this.featurePaths.resolvePropertyPathCandidates(usage, "targets", occurrence);
|
|
184855
|
+
return candidates.length === 1 ? candidates[0] : void 0;
|
|
184856
|
+
}).build(root4);
|
|
184857
|
+
this.semanticModels.set(root4, model);
|
|
184858
|
+
return model;
|
|
184016
184859
|
}
|
|
184017
184860
|
// ══════════════════════════════════════════════════════════════════════
|
|
184018
184861
|
// REQ-419 - SSM049-SSM055: metadata bindings and applicability (issue #168)
|
|
@@ -185774,7 +186617,7 @@ function specializationTargets4(node) {
|
|
|
185774
186617
|
...node.relationships ?? []
|
|
185775
186618
|
];
|
|
185776
186619
|
for (const rel2 of rels) {
|
|
185777
|
-
if (rel2.kind &&
|
|
186620
|
+
if (rel2.kind && SPECIALIZATION_KINDS9.has(rel2.kind))
|
|
185778
186621
|
out.push(...rel2.targets);
|
|
185779
186622
|
}
|
|
185780
186623
|
return out;
|
|
@@ -186559,12 +187402,12 @@ function importSignature(imp) {
|
|
|
186559
187402
|
const segments = imp.segs.map((seg) => `${seg.name ?? ""}${seg.star ? "*" : ""}${seg.recursive ? "**" : ""}`);
|
|
186560
187403
|
return `${importVisibility(imp)} ${imp.head}::${segments.join("::")}${imp.alias ? ` as ${imp.alias}` : ""}`;
|
|
186561
187404
|
}
|
|
186562
|
-
var
|
|
187405
|
+
var SPECIALIZATION_KINDS10 = /* @__PURE__ */ new Set([":>", ":>>", "specializes", "subsets", "redefines"]);
|
|
186563
187406
|
function specializationTargets5(node) {
|
|
186564
187407
|
const n2 = node;
|
|
186565
187408
|
const out = [];
|
|
186566
187409
|
for (const rel2 of [...n2.preRelationships ?? [], ...n2.relationships ?? []]) {
|
|
186567
|
-
if (rel2.kind &&
|
|
187410
|
+
if (rel2.kind && SPECIALIZATION_KINDS10.has(rel2.kind))
|
|
186568
187411
|
out.push(...rel2.targets ?? []);
|
|
186569
187412
|
}
|
|
186570
187413
|
return out;
|
|
@@ -186854,12 +187697,12 @@ function directImportEntries(imp, descriptions) {
|
|
|
186854
187697
|
}
|
|
186855
187698
|
return applyFilters(imp, selectMemberships(path10, form, descriptions), options);
|
|
186856
187699
|
}
|
|
186857
|
-
var
|
|
187700
|
+
var SPECIALIZATION_KINDS11 = /* @__PURE__ */ new Set([":>", ":>>", "specializes", "subsets", "redefines"]);
|
|
186858
187701
|
function specializationTargets6(node) {
|
|
186859
187702
|
const value = node;
|
|
186860
187703
|
const targets = [];
|
|
186861
187704
|
for (const relationship of [...value.preRelationships ?? [], ...value.relationships ?? []]) {
|
|
186862
|
-
if (relationship.kind &&
|
|
187705
|
+
if (relationship.kind && SPECIALIZATION_KINDS11.has(relationship.kind)) {
|
|
186863
187706
|
targets.push(...relationship.targets ?? []);
|
|
186864
187707
|
}
|
|
186865
187708
|
}
|
|
@@ -188703,7 +189546,7 @@ var CallableResolver = class {
|
|
|
188703
189546
|
* candidate only when it is the ONLY element with that name.
|
|
188704
189547
|
*/
|
|
188705
189548
|
candidates(name) {
|
|
188706
|
-
const simple =
|
|
189549
|
+
const simple = simpleNameOf2(name);
|
|
188707
189550
|
return (this.lookup?.descriptions(simple) ?? []).filter((description) => CALLABLE_TYPES.has(description.type));
|
|
188708
189551
|
}
|
|
188709
189552
|
/**
|
|
@@ -188719,7 +189562,7 @@ var CallableResolver = class {
|
|
|
188719
189562
|
const root4 = document2.parseResult?.value;
|
|
188720
189563
|
if (!root4)
|
|
188721
189564
|
return void 0;
|
|
188722
|
-
return collectCallables([root4, ...ast_utils_exports.streamAllContents(root4).toArray()]).get(unquoteName(
|
|
189565
|
+
return collectCallables([root4, ...ast_utils_exports.streamAllContents(root4).toArray()]).get(unquoteName(simpleNameOf2(name)));
|
|
188723
189566
|
}
|
|
188724
189567
|
/**
|
|
188725
189568
|
* SYNCHRONOUS resolution: a qualified spelling the index holds verbatim,
|
|
@@ -188735,7 +189578,7 @@ var CallableResolver = class {
|
|
|
188735
189578
|
if (node)
|
|
188736
189579
|
return node;
|
|
188737
189580
|
}
|
|
188738
|
-
const found = local ? local(unquoteName(
|
|
189581
|
+
const found = local ? local(unquoteName(simpleNameOf2(name))) : this.findLocal(document2, name);
|
|
188739
189582
|
if (found)
|
|
188740
189583
|
return found;
|
|
188741
189584
|
const candidate = this.uniqueCandidate(name);
|
|
@@ -213550,7 +214393,7 @@ async function runExport(command) {
|
|
|
213550
214393
|
}
|
|
213551
214394
|
|
|
213552
214395
|
// src/main.ts
|
|
213553
|
-
var VERSION2 = true ? "0.
|
|
214396
|
+
var VERSION2 = true ? "0.43.0" : "dev";
|
|
213554
214397
|
function display(file) {
|
|
213555
214398
|
const rel2 = path9.relative(process.cwd(), file);
|
|
213556
214399
|
return rel2 && !rel2.startsWith("..") ? rel2.split(path9.sep).join("/") : file;
|