mlitcher-rgb opened a new issue, #3583: URL: https://github.com/apache/incubator-kie-tools/issues/3583
What changed between 10.1.0 → 10.2.0 The 10.2.0 release notes ([changelog](https://apache.googlesource.com/incubator-kie-tools/+show/HEAD/packages/dmn-vscode-extension/CHANGELOG.md)) say only one thing: 10.2.0 — DMN Editor (classic), and Test Scenario Editor (classic) removed. In 10.1.0 the extension shipped two webview bundles — the legacy GWT-based "classic" editor (DmnEditorEnvelopeApp.js) and the new React-based one (NewDmnEditorEnvelopeApp.js) — and .dmn files opened in the classic editor by default. In 10.2.0 only NewDmnEditorEnvelopeApp.js ships, so every save now goes through the new editor's analysis pipeline. That pipeline adds a brand-new step in 10.2.0 called _w.computeIdentifiersLinksToExpressions (it doesn't exist in 10.1.0's NewDmnEditorEnvelopeApp.js — I diffed both bundles). It re-parses every FEEL expression in the file with an ANTLR FEEL parser, then walks the parse tree with a visitor named sg to compute "semantic tokens" for highlighting and cross-references. That's what blows up. Bug: ~/.vscode/extensions/kie-group.dmn-vscode-extension-10.2.0/dist/webview/NewDmnEditorEnvelopeApp.js (line 2, around col 9,382,764). De-minified, the visitor looks like this: class sg extends og { // ... resolveNames(e) { const t = []; if (!e.children) return t; for (let n = 0; n < e.children.length; n++) { const i = e.getChild(n); i instanceof tg /* nameRef */ || i instanceof eg /* qualifiedName */ ? t.push(...this.resolveNames(i)) : this.visit(i) && t.push(); // <-- bug: t.push() with NO argument } return t; } visitFilterPathExpression = (e) => { if (e.filterPathExpression() === null || e.qualifiedName() === null || e.qualifiedName().children === null) return this.visitChildren(e); const t = this.visit(e.filterPathExpression()); const n = this.resolveNames(e.qualifiedName()); // n can be [] from the bug above; n[0] is then undefined if (t == null ? void 0 : t.dataType.properties.has(n[0].text)) { // ...push semantic token, also reads n[0].text... } return new ag({ text: e.getText(), dataType: t == null ? void 0 : t.dataType.properties.get(n[0].text), }); }; } Two problems compound each other: resolveNames is broken. The else branch is this.visit(i) && t.push() — t.push() with no arguments pushes nothing (just returns the array's length). It was almost certainly meant to be t.push(this.visit(i)) or t.push(i). Because the children of a FEEL nameRef are terminal Identifier tokens (and nameRefOtherToken contexts for multi-word names), and the children of a qualifiedName are nameRef + DOT tokens, every recursion eventually hits the else branch and silently discards the name. The function returns [] for any normal qualified name. visitFilterPathExpression doesn't guard against the empty array. When the left side t is a typed variable (an Input Data, Decision, or imported decision-service result whose itemDefinition was registered with the parser via defineVariables → createType, giving its dataType a real properties Map), execution reaches t.dataType.properties.has(n[0].text). With n === [], n[0] is undefined, so reading .text throws exactly the message you saw: TypeError: Cannot read properties of undefined (reading 'text') at sg.visitFilterPathExpression The same bug exists right next to it in sg.visitUenpmPrimary, which is also reachable from visitChildren and would surface the same error for path-after-parens expressions. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
