@lcap/nasl-language-server-core 4.1.0-beta.2 → 4.1.0-beta.20
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/checker.d.ts +2 -2
- package/out/checker.d.ts.map +1 -1
- package/out/checker.js +128 -125
- package/out/checker.js.map +1 -1
- package/out/index.d.ts +4 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +7 -1
- package/out/index.js.map +1 -1
- package/out/reference-manager/build-q-name-def.d.ts +10 -0
- package/out/reference-manager/build-q-name-def.d.ts.map +1 -0
- package/out/reference-manager/build-q-name-def.js +66 -0
- package/out/reference-manager/build-q-name-def.js.map +1 -0
- package/out/reference-manager/builtin-q-name.d.ts +2 -3
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +13 -17
- package/out/reference-manager/builtin-q-name.js.map +1 -1
- package/out/reference-manager/collect-q-name.d.ts +2 -3
- package/out/reference-manager/collect-q-name.d.ts.map +1 -1
- package/out/reference-manager/collect-q-name.js +28 -26
- package/out/reference-manager/collect-q-name.js.map +1 -1
- package/out/reference-manager/get-q-name.d.ts.map +1 -1
- package/out/reference-manager/get-q-name.js +37 -17
- package/out/reference-manager/get-q-name.js.map +1 -1
- package/out/reference-manager/helper.d.ts +21 -0
- package/out/reference-manager/helper.d.ts.map +1 -0
- package/out/reference-manager/helper.js +102 -0
- package/out/reference-manager/helper.js.map +1 -0
- package/out/reference-manager/reference-manager.d.ts +113 -136
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +521 -554
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/reference-manager/remove-q-name.d.ts +1 -2
- package/out/reference-manager/remove-q-name.d.ts.map +1 -1
- package/out/reference-manager/remove-q-name.js +30 -26
- package/out/reference-manager/remove-q-name.js.map +1 -1
- package/out/reference-manager/rename-q-name.d.ts +2 -1
- package/out/reference-manager/rename-q-name.d.ts.map +1 -1
- package/out/reference-manager/rename-q-name.js +18 -8
- package/out/reference-manager/rename-q-name.js.map +1 -1
- package/out/reference-manager/special-string-ref.d.ts +7 -0
- package/out/reference-manager/special-string-ref.d.ts.map +1 -0
- package/out/reference-manager/special-string-ref.js +34 -0
- package/out/reference-manager/special-string-ref.js.map +1 -0
- package/out/reference-manager/symbol-type.d.ts +9 -4
- package/out/reference-manager/symbol-type.d.ts.map +1 -1
- package/out/reference-manager/symbol-type.js +29 -4
- package/out/reference-manager/symbol-type.js.map +1 -1
- package/out/reference-manager/update-nasl-fragment.d.ts +1 -5
- package/out/reference-manager/update-nasl-fragment.d.ts.map +1 -1
- package/out/reference-manager/update-nasl-fragment.js +26 -72
- package/out/reference-manager/update-nasl-fragment.js.map +1 -1
- package/out/reference-manager/view-elem-logic.d.ts +44 -0
- package/out/reference-manager/view-elem-logic.d.ts.map +1 -0
- package/out/reference-manager/view-elem-logic.js +164 -0
- package/out/reference-manager/view-elem-logic.js.map +1 -0
- package/out/services/bindable-logic-service.d.ts +64 -0
- package/out/services/bindable-logic-service.d.ts.map +1 -0
- package/out/services/bindable-logic-service.js +186 -0
- package/out/services/bindable-logic-service.js.map +1 -0
- package/out/services/client.d.ts +10 -0
- package/out/services/client.d.ts.map +1 -0
- package/out/services/client.js +21 -0
- package/out/services/client.js.map +1 -0
- package/out/services/contextual-variables-service.d.ts +14 -0
- package/out/services/contextual-variables-service.d.ts.map +1 -0
- package/out/services/contextual-variables-service.js +17 -0
- package/out/services/contextual-variables-service.js.map +1 -0
- package/out/services/event-handler-type-service.d.ts +16 -0
- package/out/services/event-handler-type-service.d.ts.map +1 -0
- package/out/services/event-handler-type-service.js +57 -0
- package/out/services/event-handler-type-service.js.map +1 -0
- package/out/services/index.d.ts +2 -0
- package/out/services/index.d.ts.map +1 -0
- package/out/services/index.js +18 -0
- package/out/services/index.js.map +1 -0
- package/out/services/types/type.d.ts +13 -0
- package/out/services/types/type.d.ts.map +1 -0
- package/out/services/types/type.js +3 -0
- package/out/services/types/type.js.map +1 -0
- package/out/symbol/traverse/concepts/frontend/bind-event.d.ts.map +1 -1
- package/out/symbol/traverse/concepts/frontend/bind-event.js +3 -0
- package/out/symbol/traverse/concepts/frontend/bind-event.js.map +1 -1
- package/out/symbol/traverse/concepts/index.d.ts +1 -1
- package/out/symbol/traverse/concepts/index.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +1 -1
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +1 -0
- package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +3 -0
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/component-def-manager/utils.js +1 -1
- package/out/typer/component-def-manager/utils.js.map +1 -1
- package/out/typer/dispatch-all.d.ts +11 -4
- package/out/typer/dispatch-all.d.ts.map +1 -1
- package/out/typer/dispatch-all.js +47 -10
- package/out/typer/dispatch-all.js.map +1 -1
- package/out/typer/dispatch-call.d.ts +14 -0
- package/out/typer/dispatch-call.d.ts.map +1 -0
- package/out/typer/dispatch-call.js +637 -0
- package/out/typer/dispatch-call.js.map +1 -0
- package/out/typer/dispatch-def.d.ts +12 -6
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +112 -107
- package/out/typer/dispatch-def.js.map +1 -1
- package/out/typer/dispatch-expr.d.ts +3 -15
- package/out/typer/dispatch-expr.d.ts.map +1 -1
- package/out/typer/dispatch-expr.js +122 -663
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-process.d.ts.map +1 -1
- package/out/typer/dispatch-process.js +50 -17
- package/out/typer/dispatch-process.js.map +1 -1
- package/out/typer/dispatch-stmt.d.ts.map +1 -1
- package/out/typer/dispatch-stmt.js +39 -38
- package/out/typer/dispatch-stmt.js.map +1 -1
- package/out/typer/dispatch-view.d.ts +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +181 -92
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/get-oql-files.d.ts +13 -0
- package/out/typer/get-oql-files.d.ts.map +1 -0
- package/out/typer/get-oql-files.js +136 -0
- package/out/typer/get-oql-files.js.map +1 -0
- package/out/typer/helper.d.ts +2 -7
- package/out/typer/helper.d.ts.map +1 -1
- package/out/typer/helper.js +5 -25
- package/out/typer/helper.js.map +1 -1
- package/out/typer/incremental-update.d.ts +1 -13
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +210 -237
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +7 -4
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +11 -11
- package/out/typer/index.js.map +1 -1
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +4 -0
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts +0 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +7 -27
- package/out/typer/subster.js.map +1 -1
- package/out/typer/topo-sort.d.ts +4 -4
- package/out/typer/topo-sort.d.ts.map +1 -1
- package/out/typer/topo-sort.js +7 -3
- package/out/typer/topo-sort.js.map +1 -1
- package/out/typer/type-manager.d.ts +3 -3
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +37 -16
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.d.ts +6 -1
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +43 -11
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +73 -14
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +202 -46
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts +1 -2
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +82 -81
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/misc.d.ts +11 -0
- package/out/utils/misc.d.ts.map +1 -0
- package/out/utils/misc.js +29 -0
- package/out/utils/misc.js.map +1 -0
- package/out/utils/string.d.ts.map +1 -1
- package/out/utils/string.js +1 -0
- package/out/utils/string.js.map +1 -1
- package/out/utils/traverse-util.d.ts +5 -0
- package/out/utils/traverse-util.d.ts.map +1 -0
- package/out/utils/traverse-util.js +69 -0
- package/out/utils/traverse-util.js.map +1 -0
- package/package.json +7 -7
- package/out/typer/nasl-predicate.d.ts +0 -10
- package/out/typer/nasl-predicate.d.ts.map +0 -1
- package/out/typer/nasl-predicate.js +0 -22
- package/out/typer/nasl-predicate.js.map +0 -1
package/out/checker.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SyntaxNode, App, BaseNode } from '@lcap/nasl-concepts';
|
|
2
2
|
import { TypeAnnotation } from '@lcap/nasl-concepts';
|
|
3
|
-
import { type SemEnv } from './typer';
|
|
3
|
+
import { type SemEnv } from './typer/typer';
|
|
4
4
|
import { Diagnostic as NaslTypeDiagnostic } from '@lcap/nasl-types';
|
|
5
5
|
export declare enum Severity {
|
|
6
6
|
WARN = "warning",
|
|
@@ -54,7 +54,7 @@ export interface DiagnosticRecord {
|
|
|
54
54
|
semanticDiagnostics: Array<Diagnostic>;
|
|
55
55
|
suggestionDiagnostics: Array<Diagnostic>;
|
|
56
56
|
}
|
|
57
|
-
export declare const transformDiagnosticsToRecords: (fileNode: SyntaxNode, diagnostics: NodeDiagnosticsMap) => Array<DiagnosticRecord>;
|
|
57
|
+
export declare const transformDiagnosticsToRecords: (fileNode: SyntaxNode, diagnostics: NodeDiagnosticsMap, deduplication?: boolean) => Array<DiagnosticRecord>;
|
|
58
58
|
export type ErrorDiagnoser = ReturnType<typeof createErrorDiagnoser>;
|
|
59
59
|
export {};
|
|
60
60
|
//# sourceMappingURL=checker.d.ts.map
|
package/out/checker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAU0F,GAAG,EAMvG,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACgE,cAAc,EAGpF,MAAM,qBAAqB,CAAC;AAS7B,OAAO,
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EAU0F,GAAG,EAMvG,QAAQ,EACT,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACgE,cAAc,EAGpF,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAOpE,oBAAY,QAAQ;IAClB,IAAI,YAAY;IAChB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAEnE,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAMF,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;AAMrE,KAAK,gBAAgB,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAqBF,KAAK,eAAe,GAAG;IACrB,GAAG,EAAE,GAAG,CAAC;IACT,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,OAAO,CAAC;IACf,yBAAyB,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAiQF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe;oCAomIpB,OAAO;sDAPW,gBAAgB,EAAE;;;;sBAhBjD,UAAU,GAAG,SAAS;;;8BA4Df,UAAU;2BAuBb,UAAU;;kBAxmInB,UAAU,WAAW,MAAM,YAAY,YAAY;EA0nIzE;AAGD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IAEX,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACrC,mBAAmB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACvC,qBAAqB,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;CAC1C;AAMD,eAAO,MAAM,6BAA6B,aAC9B,UAAU,+DAGnB,MAAM,gBAAgB,CAyCxB,CAAC;AAMF,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/out/checker.js
CHANGED
|
@@ -6,10 +6,12 @@ const nasl_concepts_1 = require("@lcap/nasl-concepts");
|
|
|
6
6
|
const service_1 = require("@lcap/nasl-concepts/service");
|
|
7
7
|
const file_node_cache_1 = require("./utils/file-node-cache");
|
|
8
8
|
const nasl_utils_1 = require("@lcap/nasl-utils");
|
|
9
|
-
const
|
|
9
|
+
const sem_diag_1 = require("./typer/sem-diag");
|
|
10
10
|
const type_predicate_1 = require("./typer/type-predicate");
|
|
11
11
|
const type_manager_1 = require("./typer/type-manager");
|
|
12
|
-
const
|
|
12
|
+
const service_2 = require("@lcap/nasl-concepts/service");
|
|
13
|
+
const lodash_1 = require("lodash");
|
|
14
|
+
const helper_1 = require("./typer/helper");
|
|
13
15
|
var Severity;
|
|
14
16
|
(function (Severity) {
|
|
15
17
|
Severity["WARN"] = "warning";
|
|
@@ -333,7 +335,7 @@ function createErrorDiagnoser(context) {
|
|
|
333
335
|
currentNode = currentNode.parentNode;
|
|
334
336
|
}
|
|
335
337
|
const finalNode = memberExpression ?? node;
|
|
336
|
-
(0,
|
|
338
|
+
(0, helper_1.createOnPush)(diagnostics, finalNode, diagnostic);
|
|
337
339
|
finalNode.tsErrorDetail = diagnostic;
|
|
338
340
|
}
|
|
339
341
|
else { }
|
|
@@ -1125,6 +1127,7 @@ function createErrorDiagnoser(context) {
|
|
|
1125
1127
|
* @param node
|
|
1126
1128
|
*/
|
|
1127
1129
|
function* checkConnector(node) {
|
|
1130
|
+
env.enterScope(node);
|
|
1128
1131
|
yield* checkModule(node);
|
|
1129
1132
|
if (node.triggerLaunchers?.length) {
|
|
1130
1133
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.triggerLaunchers, function* (node) {
|
|
@@ -1151,6 +1154,7 @@ function createErrorDiagnoser(context) {
|
|
|
1151
1154
|
yield* checkNode(node);
|
|
1152
1155
|
});
|
|
1153
1156
|
}
|
|
1157
|
+
env.exitScope();
|
|
1154
1158
|
}
|
|
1155
1159
|
/**
|
|
1156
1160
|
* 检查 连接器触发器
|
|
@@ -1265,11 +1269,14 @@ function createErrorDiagnoser(context) {
|
|
|
1265
1269
|
* @param node
|
|
1266
1270
|
*/
|
|
1267
1271
|
function* checkStructure(node) {
|
|
1272
|
+
const pConn = node.getAncestor('Connector');
|
|
1273
|
+
pConn && env.enterScope(pConn);
|
|
1268
1274
|
if (node.properties?.length) {
|
|
1269
1275
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.properties, function* (node) {
|
|
1270
1276
|
yield* checkNode(node);
|
|
1271
1277
|
});
|
|
1272
1278
|
}
|
|
1279
|
+
pConn && env.exitScope();
|
|
1273
1280
|
}
|
|
1274
1281
|
/**
|
|
1275
1282
|
* 检查 数据结构属性
|
|
@@ -1744,11 +1751,9 @@ function createErrorDiagnoser(context) {
|
|
|
1744
1751
|
* @param node
|
|
1745
1752
|
*/
|
|
1746
1753
|
function* checkInterface(node) {
|
|
1747
|
-
const
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
...(node.protocolParams || [])
|
|
1751
|
-
]);
|
|
1754
|
+
const pConn = node.getAncestor('Connector');
|
|
1755
|
+
pConn && env.enterScope(pConn);
|
|
1756
|
+
env.enterScope(node);
|
|
1752
1757
|
if (node.params?.length) {
|
|
1753
1758
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
1754
1759
|
yield* checkNode(node);
|
|
@@ -1766,18 +1771,17 @@ function createErrorDiagnoser(context) {
|
|
|
1766
1771
|
}
|
|
1767
1772
|
yield* checkNode(node.validation);
|
|
1768
1773
|
yield* checkTimeout(node);
|
|
1769
|
-
|
|
1774
|
+
env.exitScope();
|
|
1775
|
+
pConn && env.exitScope();
|
|
1770
1776
|
}
|
|
1771
1777
|
/**
|
|
1772
1778
|
* 检查 鉴权接口
|
|
1773
1779
|
* @param node
|
|
1774
1780
|
*/
|
|
1775
1781
|
function* checkAuthInterface(node) {
|
|
1776
|
-
const
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
...(node.protocolParams || [])
|
|
1780
|
-
]);
|
|
1782
|
+
const pConn = node.getAncestor('Connector');
|
|
1783
|
+
pConn && env.enterScope(pConn);
|
|
1784
|
+
env.enterScope(node);
|
|
1781
1785
|
if (node.params?.length) {
|
|
1782
1786
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
1783
1787
|
yield* checkNode(node);
|
|
@@ -1795,7 +1799,8 @@ function createErrorDiagnoser(context) {
|
|
|
1795
1799
|
}
|
|
1796
1800
|
yield* checkNode(node.validation);
|
|
1797
1801
|
yield* checkTimeout(node);
|
|
1798
|
-
|
|
1802
|
+
env.exitScope();
|
|
1803
|
+
pConn && env.exitScope();
|
|
1799
1804
|
}
|
|
1800
1805
|
/**
|
|
1801
1806
|
* 检查 接口参数
|
|
@@ -1856,7 +1861,7 @@ function createErrorDiagnoser(context) {
|
|
|
1856
1861
|
* @param node
|
|
1857
1862
|
*/
|
|
1858
1863
|
function* checkFrontend(node) {
|
|
1859
|
-
|
|
1864
|
+
env.enterScope(node);
|
|
1860
1865
|
if (node.variables?.length) {
|
|
1861
1866
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.variables, function* (node) {
|
|
1862
1867
|
yield* checkNode(node);
|
|
@@ -1872,18 +1877,14 @@ function createErrorDiagnoser(context) {
|
|
|
1872
1877
|
yield* checkNode(node);
|
|
1873
1878
|
});
|
|
1874
1879
|
}
|
|
1875
|
-
|
|
1880
|
+
env.exitScope();
|
|
1876
1881
|
}
|
|
1877
1882
|
/**
|
|
1878
1883
|
* 检查 页面
|
|
1879
1884
|
* @param node
|
|
1880
1885
|
*/
|
|
1881
1886
|
function* checkView(node) {
|
|
1882
|
-
|
|
1883
|
-
...(node.params || []),
|
|
1884
|
-
...(node.variables || []),
|
|
1885
|
-
...(node.logics || []),
|
|
1886
|
-
]);
|
|
1887
|
+
env.enterScope(node);
|
|
1887
1888
|
checkVariableAndReturnTypeAnnotations(node.variables, [], false);
|
|
1888
1889
|
const module = node.getAncestor('Module');
|
|
1889
1890
|
if (!(module?.parentKey === 'dependencies')) {
|
|
@@ -1926,18 +1927,14 @@ function createErrorDiagnoser(context) {
|
|
|
1926
1927
|
yield* checkNode(node);
|
|
1927
1928
|
});
|
|
1928
1929
|
}
|
|
1929
|
-
|
|
1930
|
+
env.exitScope();
|
|
1930
1931
|
}
|
|
1931
1932
|
/**
|
|
1932
1933
|
* 检查 业务组件
|
|
1933
1934
|
* @param node
|
|
1934
1935
|
*/
|
|
1935
1936
|
function* checkBusinessComponent(node) {
|
|
1936
|
-
|
|
1937
|
-
...(node.params || []),
|
|
1938
|
-
...(node.variables || []),
|
|
1939
|
-
...(node.logics || []),
|
|
1940
|
-
]);
|
|
1937
|
+
env.enterScope(node);
|
|
1941
1938
|
// 组件元素
|
|
1942
1939
|
if (node.elements?.length) {
|
|
1943
1940
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.elements, function* (node) {
|
|
@@ -1962,7 +1959,7 @@ function createErrorDiagnoser(context) {
|
|
|
1962
1959
|
yield* checkNode(node);
|
|
1963
1960
|
});
|
|
1964
1961
|
}
|
|
1965
|
-
|
|
1962
|
+
env.exitScope();
|
|
1966
1963
|
}
|
|
1967
1964
|
/**
|
|
1968
1965
|
* 检查 页面元素
|
|
@@ -1974,18 +1971,14 @@ function createErrorDiagnoser(context) {
|
|
|
1974
1971
|
return;
|
|
1975
1972
|
}
|
|
1976
1973
|
const shouldProvideCurrentCtx = !!(node.slotScope);
|
|
1977
|
-
let
|
|
1974
|
+
let scopeEntered = false;
|
|
1978
1975
|
if (shouldProvideCurrentCtx) {
|
|
1979
1976
|
const name = curVarCounter > 0 ? node.slotScope + curVarCounter : node.slotScope;
|
|
1980
|
-
const variable = new nasl_concepts_1.Variable({
|
|
1981
|
-
name,
|
|
1982
|
-
});
|
|
1977
|
+
const variable = new nasl_concepts_1.Variable({ name });
|
|
1983
1978
|
curVarCounter++;
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
curVarCounter--;
|
|
1988
|
-
});
|
|
1979
|
+
// @ts-expect-error ViewElement 引入的 current 目前没有加入 refMgr,VE 也没当做 ScopeNode
|
|
1980
|
+
env.enterScope(node, [variable]);
|
|
1981
|
+
scopeEntered = true;
|
|
1989
1982
|
}
|
|
1990
1983
|
if (node.bindAttrs?.length) {
|
|
1991
1984
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.bindAttrs, function* (node) {
|
|
@@ -2030,7 +2023,10 @@ function createErrorDiagnoser(context) {
|
|
|
2030
2023
|
if (!dsFilled && !hasSubComponents) {
|
|
2031
2024
|
error(errNode, '数据源不能为空');
|
|
2032
2025
|
}
|
|
2033
|
-
|
|
2026
|
+
if (scopeEntered) {
|
|
2027
|
+
env.exitScope();
|
|
2028
|
+
curVarCounter--;
|
|
2029
|
+
}
|
|
2034
2030
|
}
|
|
2035
2031
|
/**
|
|
2036
2032
|
* 检查 元素绑定属性
|
|
@@ -2188,10 +2184,7 @@ function createErrorDiagnoser(context) {
|
|
|
2188
2184
|
if (node.includeTypeArgs) {
|
|
2189
2185
|
error(node, '流程暂不支持泛型参数');
|
|
2190
2186
|
}
|
|
2191
|
-
|
|
2192
|
-
...(node?.params || []),
|
|
2193
|
-
...(node?.returns || []),
|
|
2194
|
-
]);
|
|
2187
|
+
// env.enterScope(node); 尚不支持流程 1.0
|
|
2195
2188
|
if (node.params?.length) {
|
|
2196
2189
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
2197
2190
|
yield* checkNode(node);
|
|
@@ -2217,17 +2210,14 @@ function createErrorDiagnoser(context) {
|
|
|
2217
2210
|
yield* checkNode(node);
|
|
2218
2211
|
});
|
|
2219
2212
|
}
|
|
2220
|
-
|
|
2213
|
+
// env.exitScope();
|
|
2221
2214
|
}
|
|
2222
2215
|
/**
|
|
2223
2216
|
* 检查 流程元素
|
|
2224
2217
|
* @param node
|
|
2225
2218
|
*/
|
|
2226
2219
|
function* checkProcessElement(node) {
|
|
2227
|
-
|
|
2228
|
-
...(node?.variables || []),
|
|
2229
|
-
...(node?.returns || []),
|
|
2230
|
-
]);
|
|
2220
|
+
// env.enterScope(node); 尚不支持流程1.0
|
|
2231
2221
|
if (node.returns?.length) {
|
|
2232
2222
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.returns, function* (node) {
|
|
2233
2223
|
yield* checkNode(node);
|
|
@@ -2272,7 +2262,7 @@ function createErrorDiagnoser(context) {
|
|
|
2272
2262
|
yield* checkNode(node);
|
|
2273
2263
|
});
|
|
2274
2264
|
}
|
|
2275
|
-
|
|
2265
|
+
// env.exitScope();
|
|
2276
2266
|
}
|
|
2277
2267
|
/**
|
|
2278
2268
|
* 检查 常量
|
|
@@ -2287,6 +2277,7 @@ function createErrorDiagnoser(context) {
|
|
|
2287
2277
|
* @param node
|
|
2288
2278
|
*/
|
|
2289
2279
|
function* checkProcessV2(node) {
|
|
2280
|
+
env.enterScope(node);
|
|
2290
2281
|
yield* checkNode(node.bind);
|
|
2291
2282
|
if (node.processDefinitions?.length) {
|
|
2292
2283
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.processDefinitions, function* (node) {
|
|
@@ -2303,6 +2294,7 @@ function createErrorDiagnoser(context) {
|
|
|
2303
2294
|
if (node.includeTypeArgs) {
|
|
2304
2295
|
error(node, '流程暂不支持泛型参数');
|
|
2305
2296
|
}
|
|
2297
|
+
env.exitScope();
|
|
2306
2298
|
}
|
|
2307
2299
|
/**
|
|
2308
2300
|
* 检查 绑定实体或数据结构
|
|
@@ -2316,14 +2308,7 @@ function createErrorDiagnoser(context) {
|
|
|
2316
2308
|
* @param node
|
|
2317
2309
|
*/
|
|
2318
2310
|
function* checkProcessDefinitionV2(node) {
|
|
2319
|
-
|
|
2320
|
-
...(node.variables || []),
|
|
2321
|
-
...['custom', 'processSystem'].map((name) => {
|
|
2322
|
-
return new nasl_concepts_1.Variable({
|
|
2323
|
-
name,
|
|
2324
|
-
});
|
|
2325
|
-
}),
|
|
2326
|
-
]);
|
|
2311
|
+
env.enterScope(node);
|
|
2327
2312
|
if (node.variables?.length) {
|
|
2328
2313
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.variables, function* (node) {
|
|
2329
2314
|
yield* checkNode(node);
|
|
@@ -2339,20 +2324,14 @@ function createErrorDiagnoser(context) {
|
|
|
2339
2324
|
yield* checkNode(node);
|
|
2340
2325
|
});
|
|
2341
2326
|
}
|
|
2342
|
-
|
|
2327
|
+
env.exitScope();
|
|
2343
2328
|
}
|
|
2344
2329
|
/**
|
|
2345
2330
|
* 检查 流程元素
|
|
2346
2331
|
* @param node
|
|
2347
2332
|
*/
|
|
2348
2333
|
function* checkProcessElementV2(node) {
|
|
2349
|
-
|
|
2350
|
-
...['custom', 'processSystem'].map((name) => {
|
|
2351
|
-
return new nasl_concepts_1.Variable({
|
|
2352
|
-
name,
|
|
2353
|
-
});
|
|
2354
|
-
}),
|
|
2355
|
-
]);
|
|
2334
|
+
env.enterScope(node);
|
|
2356
2335
|
yield* checkNode(node.logic);
|
|
2357
2336
|
yield* checkNode(node.flowCondition);
|
|
2358
2337
|
if (node.bindEvents?.length) {
|
|
@@ -2407,7 +2386,7 @@ function createErrorDiagnoser(context) {
|
|
|
2407
2386
|
else if (!service_1.ProcessesV2.isFromStartNode(node)) {
|
|
2408
2387
|
error(node, '节点未关联到流程图');
|
|
2409
2388
|
}
|
|
2410
|
-
|
|
2389
|
+
env.exitScope();
|
|
2411
2390
|
}
|
|
2412
2391
|
/**
|
|
2413
2392
|
* 检查 无人时,自动转派审批策略
|
|
@@ -2489,16 +2468,8 @@ function createErrorDiagnoser(context) {
|
|
|
2489
2468
|
* @param node
|
|
2490
2469
|
*/
|
|
2491
2470
|
function* checkLogic(node) {
|
|
2492
|
-
|
|
2493
|
-
...(node.params || []),
|
|
2494
|
-
...(node.returns || []),
|
|
2495
|
-
...(node.variables || []),
|
|
2496
|
-
...(node.virtualParams || [])
|
|
2497
|
-
]);
|
|
2498
|
-
// 仅检查用户写的逻辑
|
|
2499
|
-
// if (node.nodePath?.startsWith('app.logics')) {
|
|
2471
|
+
env.enterScope(node);
|
|
2500
2472
|
checkVariableAndReturnTypeAnnotations(node.variables ?? [], node.returns ?? []);
|
|
2501
|
-
// }
|
|
2502
2473
|
const module = node.getAncestor('Module');
|
|
2503
2474
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2504
2475
|
if (node.params?.length) {
|
|
@@ -2589,34 +2560,38 @@ function createErrorDiagnoser(context) {
|
|
|
2589
2560
|
if (!likeComponent) {
|
|
2590
2561
|
yield* checkTrigger(node);
|
|
2591
2562
|
}
|
|
2592
|
-
|
|
2563
|
+
env.exitScope();
|
|
2593
2564
|
}
|
|
2594
2565
|
/**
|
|
2595
2566
|
* 检查 鉴权逻辑
|
|
2596
2567
|
* @param node
|
|
2597
2568
|
*/
|
|
2598
2569
|
function* checkAuthLogic(node) {
|
|
2570
|
+
const pConn = node.getAncestor('Connector');
|
|
2571
|
+
pConn && env.enterScope(pConn);
|
|
2599
2572
|
inAuthLogic = true;
|
|
2573
|
+
// checkLogic 会 enter scope
|
|
2600
2574
|
yield* checkLogic(node);
|
|
2601
2575
|
inAuthLogic = false;
|
|
2576
|
+
pConn && env.exitScope();
|
|
2602
2577
|
}
|
|
2603
2578
|
/**
|
|
2604
2579
|
* 检查 调用接口的鉴权逻辑
|
|
2605
2580
|
* @param node
|
|
2606
2581
|
*/
|
|
2607
2582
|
function* checkAuthLogicForCallInterface(node) {
|
|
2608
|
-
|
|
2609
|
-
...(node.authParams || []),
|
|
2610
|
-
]);
|
|
2583
|
+
// authLogic 会打开 Connector 的局部-全局变量
|
|
2611
2584
|
yield* checkAuthLogic(node);
|
|
2612
|
-
unbindVariables();
|
|
2613
2585
|
}
|
|
2614
2586
|
/**
|
|
2615
2587
|
* 检查 调用接口的鉴权逻辑
|
|
2616
2588
|
* @param node
|
|
2617
2589
|
*/
|
|
2618
2590
|
function* checkConnectorLogic(node) {
|
|
2591
|
+
const pConn = node.getAncestor('Connector');
|
|
2592
|
+
pConn && env.enterScope(pConn);
|
|
2619
2593
|
yield* checkLogic(node);
|
|
2594
|
+
pConn && env.exitScope();
|
|
2620
2595
|
}
|
|
2621
2596
|
/**
|
|
2622
2597
|
* 检查 业务组件逻辑
|
|
@@ -2630,12 +2605,7 @@ function createErrorDiagnoser(context) {
|
|
|
2630
2605
|
* @param node
|
|
2631
2606
|
*/
|
|
2632
2607
|
function* checkOverriddenLogic(node) {
|
|
2633
|
-
|
|
2634
|
-
...(node.params || []),
|
|
2635
|
-
...(node.returns || []),
|
|
2636
|
-
...(node.variables || []),
|
|
2637
|
-
...(node.virtualParams || [])
|
|
2638
|
-
]);
|
|
2608
|
+
env.enterScope(node);
|
|
2639
2609
|
const module = node.getAncestor('Module');
|
|
2640
2610
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2641
2611
|
if (node.params?.length) {
|
|
@@ -2661,7 +2631,7 @@ function createErrorDiagnoser(context) {
|
|
|
2661
2631
|
});
|
|
2662
2632
|
}
|
|
2663
2633
|
yield* checkPlayground(node.playground);
|
|
2664
|
-
|
|
2634
|
+
env.exitScope();
|
|
2665
2635
|
yield* checkTrigger(node);
|
|
2666
2636
|
}
|
|
2667
2637
|
/**
|
|
@@ -2674,14 +2644,8 @@ function createErrorDiagnoser(context) {
|
|
|
2674
2644
|
* @param node
|
|
2675
2645
|
*/
|
|
2676
2646
|
function* checkSubLogic(node) {
|
|
2677
|
-
|
|
2678
|
-
...(node.params || []),
|
|
2679
|
-
...(node.returns || []),
|
|
2680
|
-
...(node.variables || []),
|
|
2681
|
-
]);
|
|
2682
|
-
// if (nd.nodePath?.startsWith('app.logics')) {
|
|
2647
|
+
env.enterScope(node);
|
|
2683
2648
|
checkVariableAndReturnTypeAnnotations(node.variables, node.returns);
|
|
2684
|
-
// }
|
|
2685
2649
|
const module = node.getAncestor('Module');
|
|
2686
2650
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2687
2651
|
if (node.params?.length) {
|
|
@@ -2707,7 +2671,7 @@ function createErrorDiagnoser(context) {
|
|
|
2707
2671
|
});
|
|
2708
2672
|
}
|
|
2709
2673
|
yield* checkPlayground(node.playground);
|
|
2710
|
-
|
|
2674
|
+
env.exitScope();
|
|
2711
2675
|
return env.getType(node);
|
|
2712
2676
|
}
|
|
2713
2677
|
/**
|
|
@@ -2774,7 +2738,7 @@ function createErrorDiagnoser(context) {
|
|
|
2774
2738
|
yield* checkVoidCallUsedAsStatement(node);
|
|
2775
2739
|
const ref = env.resolveRef(node); // 前端
|
|
2776
2740
|
// TODO: sql 函数的 namespace 带有数据库名 nasl.sqlFunction.mysql nasl.sqlFunction.oracle ...
|
|
2777
|
-
// 暂时不在
|
|
2741
|
+
// 暂时不在 gQNameDefs 里,用 isBuiltInCall 简单判断了
|
|
2778
2742
|
if (!ref && !isBuiltInCall(node)) {
|
|
2779
2743
|
const depLibName = getExtensionLibName(node);
|
|
2780
2744
|
if (depLibName) {
|
|
@@ -2816,6 +2780,9 @@ function createErrorDiagnoser(context) {
|
|
|
2816
2780
|
if (node.calleeName === 'Clear' && type?.typeKind === 'union') {
|
|
2817
2781
|
error(node, `传入类型错误,接收类型:非union类型`);
|
|
2818
2782
|
}
|
|
2783
|
+
if (node.calleeName === 'ListSort' || node.calleeName === 'ListSortAsync') {
|
|
2784
|
+
checkListSort(node);
|
|
2785
|
+
}
|
|
2819
2786
|
if (node.typeArguments?.length) {
|
|
2820
2787
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.typeArguments, function* (node) {
|
|
2821
2788
|
yield* checkNode(node);
|
|
@@ -2859,6 +2826,23 @@ function createErrorDiagnoser(context) {
|
|
|
2859
2826
|
}
|
|
2860
2827
|
}
|
|
2861
2828
|
return type;
|
|
2829
|
+
function checkListSort(nd) {
|
|
2830
|
+
for (let i = 1; i < nd.arguments.length; i++) {
|
|
2831
|
+
const expr = nd.arguments[i].expression;
|
|
2832
|
+
let resTy;
|
|
2833
|
+
if (expr?.concept === 'AnonymousFunction') {
|
|
2834
|
+
resTy = env.getType(expr.body);
|
|
2835
|
+
}
|
|
2836
|
+
else if (expr?.concept === 'SubLogic') {
|
|
2837
|
+
resTy = env.getType(expr.returns?.[0]);
|
|
2838
|
+
}
|
|
2839
|
+
const byTy = resTy?.properties?.find((prop) => prop.name === 'by')?.typeAnnotation;
|
|
2840
|
+
if (byTy?.typeKind === 'union') {
|
|
2841
|
+
// 这里使用 node.arguments[i] 则无红框,猜测是 ListSort 的特殊交互导致的问题
|
|
2842
|
+
error(node, (0, sem_diag_1.mkIncompatibleTyErr)(env, byTy, '非 union 的基础类型:如字符串、整数、布尔等'));
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
}
|
|
2862
2846
|
}
|
|
2863
2847
|
/**
|
|
2864
2848
|
* 检查 调用逻辑
|
|
@@ -3222,10 +3206,7 @@ function createErrorDiagnoser(context) {
|
|
|
3222
3206
|
* @param node
|
|
3223
3207
|
*/
|
|
3224
3208
|
function* checkForEachStatement(node) {
|
|
3225
|
-
|
|
3226
|
-
node.item,
|
|
3227
|
-
node.index,
|
|
3228
|
-
]);
|
|
3209
|
+
env.enterScope(node);
|
|
3229
3210
|
if (ensureNodeKeyExists(node, 'each')) {
|
|
3230
3211
|
yield* checkNode(node.each);
|
|
3231
3212
|
}
|
|
@@ -3247,7 +3228,7 @@ function createErrorDiagnoser(context) {
|
|
|
3247
3228
|
error(node, `ForEach:循环列表:参数类型不匹配!结束值自动推导失败。`);
|
|
3248
3229
|
}
|
|
3249
3230
|
}
|
|
3250
|
-
|
|
3231
|
+
env.exitScope();
|
|
3251
3232
|
}
|
|
3252
3233
|
/**
|
|
3253
3234
|
* 检查 循环分支
|
|
@@ -3277,7 +3258,7 @@ function createErrorDiagnoser(context) {
|
|
|
3277
3258
|
/**
|
|
3278
3259
|
* 参考类型检查器的 {@link tpIdentifier}方法
|
|
3279
3260
|
*/
|
|
3280
|
-
return
|
|
3261
|
+
return type_manager_1.naslLongTy;
|
|
3281
3262
|
}
|
|
3282
3263
|
else if (node.name === 'it') {
|
|
3283
3264
|
return env.getType(node);
|
|
@@ -3699,7 +3680,7 @@ function createErrorDiagnoser(context) {
|
|
|
3699
3680
|
const { entityAsName } = node;
|
|
3700
3681
|
const entityNamespace = node.entityNamespace ?? node.getAncestor('CallQueryComponent')?.from?.entityNamespace;
|
|
3701
3682
|
const entityQName = `${entityNamespace}.${entityAsName}`;
|
|
3702
|
-
const ref = referenceManager.
|
|
3683
|
+
const ref = referenceManager.gQNameDefs.get(entityQName);
|
|
3703
3684
|
if (!ref) {
|
|
3704
3685
|
error(node, `找不到实体 ${entityAsName}。`);
|
|
3705
3686
|
return;
|
|
@@ -3833,6 +3814,18 @@ function createErrorDiagnoser(context) {
|
|
|
3833
3814
|
}
|
|
3834
3815
|
return env.getType(node);
|
|
3835
3816
|
}
|
|
3817
|
+
function* checkVariadicExpression(node) {
|
|
3818
|
+
if (!node.expressions?.[0]) {
|
|
3819
|
+
error(node, '表达式不能为空!');
|
|
3820
|
+
}
|
|
3821
|
+
if (!node.expressions?.[1]) {
|
|
3822
|
+
error(node, '表达式不能为空!');
|
|
3823
|
+
}
|
|
3824
|
+
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.expressions, function* (node) {
|
|
3825
|
+
yield* checkNode(node);
|
|
3826
|
+
});
|
|
3827
|
+
return env.getType(node);
|
|
3828
|
+
}
|
|
3836
3829
|
/**
|
|
3837
3830
|
* 检查 一元表达式
|
|
3838
3831
|
* @param node
|
|
@@ -3869,14 +3862,14 @@ function createErrorDiagnoser(context) {
|
|
|
3869
3862
|
*/
|
|
3870
3863
|
function* checkFunction(node) {
|
|
3871
3864
|
if (ensureNodeKeyExists(node, 'returnExpression')) {
|
|
3872
|
-
|
|
3865
|
+
env.enterScope(node);
|
|
3873
3866
|
if (node.params?.length) {
|
|
3874
3867
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
3875
3868
|
yield* checkNode(node);
|
|
3876
3869
|
});
|
|
3877
3870
|
}
|
|
3878
3871
|
yield* checkNode(node.returnExpression);
|
|
3879
|
-
|
|
3872
|
+
env.exitScope();
|
|
3880
3873
|
}
|
|
3881
3874
|
}
|
|
3882
3875
|
/**
|
|
@@ -3884,7 +3877,7 @@ function createErrorDiagnoser(context) {
|
|
|
3884
3877
|
* @param node
|
|
3885
3878
|
*/
|
|
3886
3879
|
function* checkAnonymousFunction(node) {
|
|
3887
|
-
|
|
3880
|
+
env.enterScope(node);
|
|
3888
3881
|
if (node.params?.length) {
|
|
3889
3882
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
3890
3883
|
yield* checkNode(node);
|
|
@@ -3893,7 +3886,7 @@ function createErrorDiagnoser(context) {
|
|
|
3893
3886
|
if (ensureNodeKeyExists(node, 'body')) {
|
|
3894
3887
|
yield* checkNode(node.body);
|
|
3895
3888
|
}
|
|
3896
|
-
|
|
3889
|
+
env.exitScope();
|
|
3897
3890
|
}
|
|
3898
3891
|
/**
|
|
3899
3892
|
* 检查 验证规则
|
|
@@ -4011,7 +4004,7 @@ function createErrorDiagnoser(context) {
|
|
|
4011
4004
|
function* dispatchNode(node) {
|
|
4012
4005
|
try {
|
|
4013
4006
|
// 调用表达式
|
|
4014
|
-
if ((0,
|
|
4007
|
+
if ((0, service_2.isNaslCallExpr)(node)) {
|
|
4015
4008
|
return yield* checkCallExpression(node);
|
|
4016
4009
|
}
|
|
4017
4010
|
const { concept } = node;
|
|
@@ -4222,6 +4215,8 @@ function createErrorDiagnoser(context) {
|
|
|
4222
4215
|
return yield* checkPaginate(node);
|
|
4223
4216
|
case 'BinaryExpression':
|
|
4224
4217
|
return yield* checkBinaryExpression(node);
|
|
4218
|
+
case 'VariadicExpression':
|
|
4219
|
+
return yield* checkVariadicExpression(node);
|
|
4225
4220
|
case 'UnaryExpression':
|
|
4226
4221
|
return yield* checkUnaryExpression(node);
|
|
4227
4222
|
case 'Comment':
|
|
@@ -4372,8 +4367,10 @@ function createErrorDiagnoser(context) {
|
|
|
4372
4367
|
};
|
|
4373
4368
|
}
|
|
4374
4369
|
exports.createErrorDiagnoser = createErrorDiagnoser;
|
|
4375
|
-
|
|
4376
|
-
|
|
4370
|
+
function deduplicateDiagnostics(diagnostics) {
|
|
4371
|
+
return (0, lodash_1.uniqWith)(diagnostics, (a, b) => a.node === b.node && a.message === b.message);
|
|
4372
|
+
}
|
|
4373
|
+
const transformDiagnosticsToRecords = (fileNode, diagnostics, deduplication = true) => {
|
|
4377
4374
|
let filePath;
|
|
4378
4375
|
try {
|
|
4379
4376
|
filePath = fileNode.concept !== 'App' ? fileNode.getEmbeddedFilePath() : undefined;
|
|
@@ -4381,10 +4378,8 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4381
4378
|
catch (err) {
|
|
4382
4379
|
nasl_utils_1.isDebugMode && console.error(err);
|
|
4383
4380
|
}
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
const syntaxDiagnostics = [];
|
|
4387
|
-
//
|
|
4381
|
+
let semanticDiagnostics = [];
|
|
4382
|
+
let suggestionDiagnostics = [];
|
|
4388
4383
|
diagnostics.forEach((err, node) => {
|
|
4389
4384
|
if (err.length) {
|
|
4390
4385
|
err.forEach((item) => {
|
|
@@ -4397,17 +4392,25 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4397
4392
|
}
|
|
4398
4393
|
});
|
|
4399
4394
|
if (filePath) {
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4395
|
+
if (deduplication) {
|
|
4396
|
+
if (semanticDiagnostics.length) {
|
|
4397
|
+
semanticDiagnostics = deduplicateDiagnostics(semanticDiagnostics);
|
|
4398
|
+
}
|
|
4399
|
+
if (suggestionDiagnostics.length) {
|
|
4400
|
+
suggestionDiagnostics = deduplicateDiagnostics(suggestionDiagnostics);
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
return [{
|
|
4404
|
+
filePath,
|
|
4405
|
+
id: fileNode.id,
|
|
4406
|
+
node: fileNode,
|
|
4407
|
+
semanticDiagnostics,
|
|
4408
|
+
suggestionDiagnostics,
|
|
4409
|
+
syntaxDiagnostics: [],
|
|
4410
|
+
message: '',
|
|
4411
|
+
}];
|
|
4412
|
+
}
|
|
4413
|
+
return [];
|
|
4411
4414
|
};
|
|
4412
4415
|
exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
|
|
4413
4416
|
// @ts-expect-error
|