@lcap/nasl-language-server-core 4.1.0-beta.9 → 4.1.0-creator.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/checker.d.ts +1 -1
- package/out/checker.d.ts.map +1 -1
- package/out/checker.js +92 -123
- 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 -2
- 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 +26 -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 -18
- 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 +103 -138
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +442 -523
- 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 +21 -23
- 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 +19 -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 +10 -6
- package/out/reference-manager/symbol-type.d.ts.map +1 -1
- package/out/reference-manager/symbol-type.js +29 -8
- 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 +23 -69
- 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/symbol/traverse/concepts/logic/expression/expression.d.ts.map +1 -1
- package/out/symbol/traverse/concepts/logic/expression/expression.js +2 -1
- package/out/symbol/traverse/concepts/logic/expression/expression.js.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 +10 -3
- package/out/typer/dispatch-all.d.ts.map +1 -1
- package/out/typer/dispatch-all.js +45 -8
- 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 +92 -678
- 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 +49 -16
- 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.map +1 -1
- package/out/typer/dispatch-view.js +193 -100
- 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 +192 -203
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +7 -5
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +11 -13
- 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 +19 -34
- 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 +40 -17
- 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 +69 -12
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +195 -34
- 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 +65 -80
- 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 +6 -6
- 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
|
@@ -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,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAK5C,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
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;AAkQF;;;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
|
@@ -9,7 +9,8 @@ const nasl_utils_1 = require("@lcap/nasl-utils");
|
|
|
9
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");
|
|
13
14
|
const helper_1 = require("./typer/helper");
|
|
14
15
|
var Severity;
|
|
15
16
|
(function (Severity) {
|
|
@@ -79,7 +80,8 @@ function getExpressionNodeName(concept) {
|
|
|
79
80
|
CallInterface: '接口',
|
|
80
81
|
CallAuthInterface: '鉴权接口',
|
|
81
82
|
CallConnector: '连接器',
|
|
82
|
-
CallMicroserviceInterface: '',
|
|
83
|
+
CallMicroserviceInterface: '微服务接口',
|
|
84
|
+
CallGatewayInterface: '网关接口',
|
|
83
85
|
CallEvent: '事件',
|
|
84
86
|
};
|
|
85
87
|
return expressionNodeName[concept];
|
|
@@ -1126,6 +1128,7 @@ function createErrorDiagnoser(context) {
|
|
|
1126
1128
|
* @param node
|
|
1127
1129
|
*/
|
|
1128
1130
|
function* checkConnector(node) {
|
|
1131
|
+
env.enterScope(node);
|
|
1129
1132
|
yield* checkModule(node);
|
|
1130
1133
|
if (node.triggerLaunchers?.length) {
|
|
1131
1134
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.triggerLaunchers, function* (node) {
|
|
@@ -1152,6 +1155,7 @@ function createErrorDiagnoser(context) {
|
|
|
1152
1155
|
yield* checkNode(node);
|
|
1153
1156
|
});
|
|
1154
1157
|
}
|
|
1158
|
+
env.exitScope();
|
|
1155
1159
|
}
|
|
1156
1160
|
/**
|
|
1157
1161
|
* 检查 连接器触发器
|
|
@@ -1266,11 +1270,14 @@ function createErrorDiagnoser(context) {
|
|
|
1266
1270
|
* @param node
|
|
1267
1271
|
*/
|
|
1268
1272
|
function* checkStructure(node) {
|
|
1273
|
+
const pConn = node.getAncestor('Connector');
|
|
1274
|
+
pConn && env.enterScope(pConn);
|
|
1269
1275
|
if (node.properties?.length) {
|
|
1270
1276
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.properties, function* (node) {
|
|
1271
1277
|
yield* checkNode(node);
|
|
1272
1278
|
});
|
|
1273
1279
|
}
|
|
1280
|
+
pConn && env.exitScope();
|
|
1274
1281
|
}
|
|
1275
1282
|
/**
|
|
1276
1283
|
* 检查 数据结构属性
|
|
@@ -1745,11 +1752,9 @@ function createErrorDiagnoser(context) {
|
|
|
1745
1752
|
* @param node
|
|
1746
1753
|
*/
|
|
1747
1754
|
function* checkInterface(node) {
|
|
1748
|
-
const
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
...(node.protocolParams || [])
|
|
1752
|
-
]);
|
|
1755
|
+
const pConn = node.getAncestor('Connector');
|
|
1756
|
+
pConn && env.enterScope(pConn);
|
|
1757
|
+
env.enterScope(node);
|
|
1753
1758
|
if (node.params?.length) {
|
|
1754
1759
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
1755
1760
|
yield* checkNode(node);
|
|
@@ -1767,18 +1772,17 @@ function createErrorDiagnoser(context) {
|
|
|
1767
1772
|
}
|
|
1768
1773
|
yield* checkNode(node.validation);
|
|
1769
1774
|
yield* checkTimeout(node);
|
|
1770
|
-
|
|
1775
|
+
env.exitScope();
|
|
1776
|
+
pConn && env.exitScope();
|
|
1771
1777
|
}
|
|
1772
1778
|
/**
|
|
1773
1779
|
* 检查 鉴权接口
|
|
1774
1780
|
* @param node
|
|
1775
1781
|
*/
|
|
1776
1782
|
function* checkAuthInterface(node) {
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
...(node.protocolParams || [])
|
|
1781
|
-
]);
|
|
1783
|
+
const pConn = node.getAncestor('Connector');
|
|
1784
|
+
pConn && env.enterScope(pConn);
|
|
1785
|
+
env.enterScope(node);
|
|
1782
1786
|
if (node.params?.length) {
|
|
1783
1787
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
1784
1788
|
yield* checkNode(node);
|
|
@@ -1796,7 +1800,8 @@ function createErrorDiagnoser(context) {
|
|
|
1796
1800
|
}
|
|
1797
1801
|
yield* checkNode(node.validation);
|
|
1798
1802
|
yield* checkTimeout(node);
|
|
1799
|
-
|
|
1803
|
+
env.exitScope();
|
|
1804
|
+
pConn && env.exitScope();
|
|
1800
1805
|
}
|
|
1801
1806
|
/**
|
|
1802
1807
|
* 检查 接口参数
|
|
@@ -1857,7 +1862,7 @@ function createErrorDiagnoser(context) {
|
|
|
1857
1862
|
* @param node
|
|
1858
1863
|
*/
|
|
1859
1864
|
function* checkFrontend(node) {
|
|
1860
|
-
|
|
1865
|
+
env.enterScope(node);
|
|
1861
1866
|
if (node.variables?.length) {
|
|
1862
1867
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.variables, function* (node) {
|
|
1863
1868
|
yield* checkNode(node);
|
|
@@ -1873,18 +1878,14 @@ function createErrorDiagnoser(context) {
|
|
|
1873
1878
|
yield* checkNode(node);
|
|
1874
1879
|
});
|
|
1875
1880
|
}
|
|
1876
|
-
|
|
1881
|
+
env.exitScope();
|
|
1877
1882
|
}
|
|
1878
1883
|
/**
|
|
1879
1884
|
* 检查 页面
|
|
1880
1885
|
* @param node
|
|
1881
1886
|
*/
|
|
1882
1887
|
function* checkView(node) {
|
|
1883
|
-
|
|
1884
|
-
...(node.params || []),
|
|
1885
|
-
...(node.variables || []),
|
|
1886
|
-
...(node.logics || []),
|
|
1887
|
-
]);
|
|
1888
|
+
env.enterScope(node);
|
|
1888
1889
|
checkVariableAndReturnTypeAnnotations(node.variables, [], false);
|
|
1889
1890
|
const module = node.getAncestor('Module');
|
|
1890
1891
|
if (!(module?.parentKey === 'dependencies')) {
|
|
@@ -1927,18 +1928,14 @@ function createErrorDiagnoser(context) {
|
|
|
1927
1928
|
yield* checkNode(node);
|
|
1928
1929
|
});
|
|
1929
1930
|
}
|
|
1930
|
-
|
|
1931
|
+
env.exitScope();
|
|
1931
1932
|
}
|
|
1932
1933
|
/**
|
|
1933
1934
|
* 检查 业务组件
|
|
1934
1935
|
* @param node
|
|
1935
1936
|
*/
|
|
1936
1937
|
function* checkBusinessComponent(node) {
|
|
1937
|
-
|
|
1938
|
-
...(node.params || []),
|
|
1939
|
-
...(node.variables || []),
|
|
1940
|
-
...(node.logics || []),
|
|
1941
|
-
]);
|
|
1938
|
+
env.enterScope(node);
|
|
1942
1939
|
// 组件元素
|
|
1943
1940
|
if (node.elements?.length) {
|
|
1944
1941
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.elements, function* (node) {
|
|
@@ -1963,7 +1960,7 @@ function createErrorDiagnoser(context) {
|
|
|
1963
1960
|
yield* checkNode(node);
|
|
1964
1961
|
});
|
|
1965
1962
|
}
|
|
1966
|
-
|
|
1963
|
+
env.exitScope();
|
|
1967
1964
|
}
|
|
1968
1965
|
/**
|
|
1969
1966
|
* 检查 页面元素
|
|
@@ -1975,18 +1972,14 @@ function createErrorDiagnoser(context) {
|
|
|
1975
1972
|
return;
|
|
1976
1973
|
}
|
|
1977
1974
|
const shouldProvideCurrentCtx = !!(node.slotScope);
|
|
1978
|
-
let
|
|
1975
|
+
let scopeEntered = false;
|
|
1979
1976
|
if (shouldProvideCurrentCtx) {
|
|
1980
1977
|
const name = curVarCounter > 0 ? node.slotScope + curVarCounter : node.slotScope;
|
|
1981
|
-
const variable = new nasl_concepts_1.Variable({
|
|
1982
|
-
name,
|
|
1983
|
-
});
|
|
1978
|
+
const variable = new nasl_concepts_1.Variable({ name });
|
|
1984
1979
|
curVarCounter++;
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
curVarCounter--;
|
|
1989
|
-
});
|
|
1980
|
+
// @ts-expect-error ViewElement 引入的 current 目前没有加入 refMgr,VE 也没当做 ScopeNode
|
|
1981
|
+
env.enterScope(node, [variable]);
|
|
1982
|
+
scopeEntered = true;
|
|
1990
1983
|
}
|
|
1991
1984
|
if (node.bindAttrs?.length) {
|
|
1992
1985
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.bindAttrs, function* (node) {
|
|
@@ -2031,7 +2024,10 @@ function createErrorDiagnoser(context) {
|
|
|
2031
2024
|
if (!dsFilled && !hasSubComponents) {
|
|
2032
2025
|
error(errNode, '数据源不能为空');
|
|
2033
2026
|
}
|
|
2034
|
-
|
|
2027
|
+
if (scopeEntered) {
|
|
2028
|
+
env.exitScope();
|
|
2029
|
+
curVarCounter--;
|
|
2030
|
+
}
|
|
2035
2031
|
}
|
|
2036
2032
|
/**
|
|
2037
2033
|
* 检查 元素绑定属性
|
|
@@ -2189,10 +2185,7 @@ function createErrorDiagnoser(context) {
|
|
|
2189
2185
|
if (node.includeTypeArgs) {
|
|
2190
2186
|
error(node, '流程暂不支持泛型参数');
|
|
2191
2187
|
}
|
|
2192
|
-
|
|
2193
|
-
...(node?.params || []),
|
|
2194
|
-
...(node?.returns || []),
|
|
2195
|
-
]);
|
|
2188
|
+
// env.enterScope(node); 尚不支持流程 1.0
|
|
2196
2189
|
if (node.params?.length) {
|
|
2197
2190
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
2198
2191
|
yield* checkNode(node);
|
|
@@ -2218,17 +2211,14 @@ function createErrorDiagnoser(context) {
|
|
|
2218
2211
|
yield* checkNode(node);
|
|
2219
2212
|
});
|
|
2220
2213
|
}
|
|
2221
|
-
|
|
2214
|
+
// env.exitScope();
|
|
2222
2215
|
}
|
|
2223
2216
|
/**
|
|
2224
2217
|
* 检查 流程元素
|
|
2225
2218
|
* @param node
|
|
2226
2219
|
*/
|
|
2227
2220
|
function* checkProcessElement(node) {
|
|
2228
|
-
|
|
2229
|
-
...(node?.variables || []),
|
|
2230
|
-
...(node?.returns || []),
|
|
2231
|
-
]);
|
|
2221
|
+
// env.enterScope(node); 尚不支持流程1.0
|
|
2232
2222
|
if (node.returns?.length) {
|
|
2233
2223
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.returns, function* (node) {
|
|
2234
2224
|
yield* checkNode(node);
|
|
@@ -2273,7 +2263,7 @@ function createErrorDiagnoser(context) {
|
|
|
2273
2263
|
yield* checkNode(node);
|
|
2274
2264
|
});
|
|
2275
2265
|
}
|
|
2276
|
-
|
|
2266
|
+
// env.exitScope();
|
|
2277
2267
|
}
|
|
2278
2268
|
/**
|
|
2279
2269
|
* 检查 常量
|
|
@@ -2288,6 +2278,7 @@ function createErrorDiagnoser(context) {
|
|
|
2288
2278
|
* @param node
|
|
2289
2279
|
*/
|
|
2290
2280
|
function* checkProcessV2(node) {
|
|
2281
|
+
env.enterScope(node);
|
|
2291
2282
|
yield* checkNode(node.bind);
|
|
2292
2283
|
if (node.processDefinitions?.length) {
|
|
2293
2284
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.processDefinitions, function* (node) {
|
|
@@ -2304,6 +2295,7 @@ function createErrorDiagnoser(context) {
|
|
|
2304
2295
|
if (node.includeTypeArgs) {
|
|
2305
2296
|
error(node, '流程暂不支持泛型参数');
|
|
2306
2297
|
}
|
|
2298
|
+
env.exitScope();
|
|
2307
2299
|
}
|
|
2308
2300
|
/**
|
|
2309
2301
|
* 检查 绑定实体或数据结构
|
|
@@ -2317,14 +2309,7 @@ function createErrorDiagnoser(context) {
|
|
|
2317
2309
|
* @param node
|
|
2318
2310
|
*/
|
|
2319
2311
|
function* checkProcessDefinitionV2(node) {
|
|
2320
|
-
|
|
2321
|
-
...(node.variables || []),
|
|
2322
|
-
...['custom', 'processSystem'].map((name) => {
|
|
2323
|
-
return new nasl_concepts_1.Variable({
|
|
2324
|
-
name,
|
|
2325
|
-
});
|
|
2326
|
-
}),
|
|
2327
|
-
]);
|
|
2312
|
+
env.enterScope(node);
|
|
2328
2313
|
if (node.variables?.length) {
|
|
2329
2314
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.variables, function* (node) {
|
|
2330
2315
|
yield* checkNode(node);
|
|
@@ -2340,20 +2325,14 @@ function createErrorDiagnoser(context) {
|
|
|
2340
2325
|
yield* checkNode(node);
|
|
2341
2326
|
});
|
|
2342
2327
|
}
|
|
2343
|
-
|
|
2328
|
+
env.exitScope();
|
|
2344
2329
|
}
|
|
2345
2330
|
/**
|
|
2346
2331
|
* 检查 流程元素
|
|
2347
2332
|
* @param node
|
|
2348
2333
|
*/
|
|
2349
2334
|
function* checkProcessElementV2(node) {
|
|
2350
|
-
|
|
2351
|
-
...['custom', 'processSystem'].map((name) => {
|
|
2352
|
-
return new nasl_concepts_1.Variable({
|
|
2353
|
-
name,
|
|
2354
|
-
});
|
|
2355
|
-
}),
|
|
2356
|
-
]);
|
|
2335
|
+
env.enterScope(node);
|
|
2357
2336
|
yield* checkNode(node.logic);
|
|
2358
2337
|
yield* checkNode(node.flowCondition);
|
|
2359
2338
|
if (node.bindEvents?.length) {
|
|
@@ -2408,7 +2387,7 @@ function createErrorDiagnoser(context) {
|
|
|
2408
2387
|
else if (!service_1.ProcessesV2.isFromStartNode(node)) {
|
|
2409
2388
|
error(node, '节点未关联到流程图');
|
|
2410
2389
|
}
|
|
2411
|
-
|
|
2390
|
+
env.exitScope();
|
|
2412
2391
|
}
|
|
2413
2392
|
/**
|
|
2414
2393
|
* 检查 无人时,自动转派审批策略
|
|
@@ -2490,16 +2469,8 @@ function createErrorDiagnoser(context) {
|
|
|
2490
2469
|
* @param node
|
|
2491
2470
|
*/
|
|
2492
2471
|
function* checkLogic(node) {
|
|
2493
|
-
|
|
2494
|
-
...(node.params || []),
|
|
2495
|
-
...(node.returns || []),
|
|
2496
|
-
...(node.variables || []),
|
|
2497
|
-
...(node.virtualParams || [])
|
|
2498
|
-
]);
|
|
2499
|
-
// 仅检查用户写的逻辑
|
|
2500
|
-
// if (node.nodePath?.startsWith('app.logics')) {
|
|
2472
|
+
env.enterScope(node);
|
|
2501
2473
|
checkVariableAndReturnTypeAnnotations(node.variables ?? [], node.returns ?? []);
|
|
2502
|
-
// }
|
|
2503
2474
|
const module = node.getAncestor('Module');
|
|
2504
2475
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2505
2476
|
if (node.params?.length) {
|
|
@@ -2590,34 +2561,38 @@ function createErrorDiagnoser(context) {
|
|
|
2590
2561
|
if (!likeComponent) {
|
|
2591
2562
|
yield* checkTrigger(node);
|
|
2592
2563
|
}
|
|
2593
|
-
|
|
2564
|
+
env.exitScope();
|
|
2594
2565
|
}
|
|
2595
2566
|
/**
|
|
2596
2567
|
* 检查 鉴权逻辑
|
|
2597
2568
|
* @param node
|
|
2598
2569
|
*/
|
|
2599
2570
|
function* checkAuthLogic(node) {
|
|
2571
|
+
const pConn = node.getAncestor('Connector');
|
|
2572
|
+
pConn && env.enterScope(pConn);
|
|
2600
2573
|
inAuthLogic = true;
|
|
2574
|
+
// checkLogic 会 enter scope
|
|
2601
2575
|
yield* checkLogic(node);
|
|
2602
2576
|
inAuthLogic = false;
|
|
2577
|
+
pConn && env.exitScope();
|
|
2603
2578
|
}
|
|
2604
2579
|
/**
|
|
2605
2580
|
* 检查 调用接口的鉴权逻辑
|
|
2606
2581
|
* @param node
|
|
2607
2582
|
*/
|
|
2608
2583
|
function* checkAuthLogicForCallInterface(node) {
|
|
2609
|
-
|
|
2610
|
-
...(node.authParams || []),
|
|
2611
|
-
]);
|
|
2584
|
+
// authLogic 会打开 Connector 的局部-全局变量
|
|
2612
2585
|
yield* checkAuthLogic(node);
|
|
2613
|
-
unbindVariables();
|
|
2614
2586
|
}
|
|
2615
2587
|
/**
|
|
2616
2588
|
* 检查 调用接口的鉴权逻辑
|
|
2617
2589
|
* @param node
|
|
2618
2590
|
*/
|
|
2619
2591
|
function* checkConnectorLogic(node) {
|
|
2592
|
+
const pConn = node.getAncestor('Connector');
|
|
2593
|
+
pConn && env.enterScope(pConn);
|
|
2620
2594
|
yield* checkLogic(node);
|
|
2595
|
+
pConn && env.exitScope();
|
|
2621
2596
|
}
|
|
2622
2597
|
/**
|
|
2623
2598
|
* 检查 业务组件逻辑
|
|
@@ -2631,12 +2606,7 @@ function createErrorDiagnoser(context) {
|
|
|
2631
2606
|
* @param node
|
|
2632
2607
|
*/
|
|
2633
2608
|
function* checkOverriddenLogic(node) {
|
|
2634
|
-
|
|
2635
|
-
...(node.params || []),
|
|
2636
|
-
...(node.returns || []),
|
|
2637
|
-
...(node.variables || []),
|
|
2638
|
-
...(node.virtualParams || [])
|
|
2639
|
-
]);
|
|
2609
|
+
env.enterScope(node);
|
|
2640
2610
|
const module = node.getAncestor('Module');
|
|
2641
2611
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2642
2612
|
if (node.params?.length) {
|
|
@@ -2662,7 +2632,7 @@ function createErrorDiagnoser(context) {
|
|
|
2662
2632
|
});
|
|
2663
2633
|
}
|
|
2664
2634
|
yield* checkPlayground(node.playground);
|
|
2665
|
-
|
|
2635
|
+
env.exitScope();
|
|
2666
2636
|
yield* checkTrigger(node);
|
|
2667
2637
|
}
|
|
2668
2638
|
/**
|
|
@@ -2675,14 +2645,8 @@ function createErrorDiagnoser(context) {
|
|
|
2675
2645
|
* @param node
|
|
2676
2646
|
*/
|
|
2677
2647
|
function* checkSubLogic(node) {
|
|
2678
|
-
|
|
2679
|
-
...(node.params || []),
|
|
2680
|
-
...(node.returns || []),
|
|
2681
|
-
...(node.variables || []),
|
|
2682
|
-
]);
|
|
2683
|
-
// if (nd.nodePath?.startsWith('app.logics')) {
|
|
2648
|
+
env.enterScope(node);
|
|
2684
2649
|
checkVariableAndReturnTypeAnnotations(node.variables, node.returns);
|
|
2685
|
-
// }
|
|
2686
2650
|
const module = node.getAncestor('Module');
|
|
2687
2651
|
if (!(module?.parentKey === 'dependencies')) {
|
|
2688
2652
|
if (node.params?.length) {
|
|
@@ -2708,7 +2672,7 @@ function createErrorDiagnoser(context) {
|
|
|
2708
2672
|
});
|
|
2709
2673
|
}
|
|
2710
2674
|
yield* checkPlayground(node.playground);
|
|
2711
|
-
|
|
2675
|
+
env.exitScope();
|
|
2712
2676
|
return env.getType(node);
|
|
2713
2677
|
}
|
|
2714
2678
|
/**
|
|
@@ -2775,7 +2739,7 @@ function createErrorDiagnoser(context) {
|
|
|
2775
2739
|
yield* checkVoidCallUsedAsStatement(node);
|
|
2776
2740
|
const ref = env.resolveRef(node); // 前端
|
|
2777
2741
|
// TODO: sql 函数的 namespace 带有数据库名 nasl.sqlFunction.mysql nasl.sqlFunction.oracle ...
|
|
2778
|
-
// 暂时不在
|
|
2742
|
+
// 暂时不在 gQNameDefs 里,用 isBuiltInCall 简单判断了
|
|
2779
2743
|
if (!ref && !isBuiltInCall(node)) {
|
|
2780
2744
|
const depLibName = getExtensionLibName(node);
|
|
2781
2745
|
if (depLibName) {
|
|
@@ -3243,10 +3207,7 @@ function createErrorDiagnoser(context) {
|
|
|
3243
3207
|
* @param node
|
|
3244
3208
|
*/
|
|
3245
3209
|
function* checkForEachStatement(node) {
|
|
3246
|
-
|
|
3247
|
-
node.item,
|
|
3248
|
-
node.index,
|
|
3249
|
-
]);
|
|
3210
|
+
env.enterScope(node);
|
|
3250
3211
|
if (ensureNodeKeyExists(node, 'each')) {
|
|
3251
3212
|
yield* checkNode(node.each);
|
|
3252
3213
|
}
|
|
@@ -3268,7 +3229,7 @@ function createErrorDiagnoser(context) {
|
|
|
3268
3229
|
error(node, `ForEach:循环列表:参数类型不匹配!结束值自动推导失败。`);
|
|
3269
3230
|
}
|
|
3270
3231
|
}
|
|
3271
|
-
|
|
3232
|
+
env.exitScope();
|
|
3272
3233
|
}
|
|
3273
3234
|
/**
|
|
3274
3235
|
* 检查 循环分支
|
|
@@ -3720,7 +3681,7 @@ function createErrorDiagnoser(context) {
|
|
|
3720
3681
|
const { entityAsName } = node;
|
|
3721
3682
|
const entityNamespace = node.entityNamespace ?? node.getAncestor('CallQueryComponent')?.from?.entityNamespace;
|
|
3722
3683
|
const entityQName = `${entityNamespace}.${entityAsName}`;
|
|
3723
|
-
const ref = referenceManager.
|
|
3684
|
+
const ref = referenceManager.gQNameDefs.get(entityQName);
|
|
3724
3685
|
if (!ref) {
|
|
3725
3686
|
error(node, `找不到实体 ${entityAsName}。`);
|
|
3726
3687
|
return;
|
|
@@ -3902,14 +3863,14 @@ function createErrorDiagnoser(context) {
|
|
|
3902
3863
|
*/
|
|
3903
3864
|
function* checkFunction(node) {
|
|
3904
3865
|
if (ensureNodeKeyExists(node, 'returnExpression')) {
|
|
3905
|
-
|
|
3866
|
+
env.enterScope(node);
|
|
3906
3867
|
if (node.params?.length) {
|
|
3907
3868
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
3908
3869
|
yield* checkNode(node);
|
|
3909
3870
|
});
|
|
3910
3871
|
}
|
|
3911
3872
|
yield* checkNode(node.returnExpression);
|
|
3912
|
-
|
|
3873
|
+
env.exitScope();
|
|
3913
3874
|
}
|
|
3914
3875
|
}
|
|
3915
3876
|
/**
|
|
@@ -3917,7 +3878,7 @@ function createErrorDiagnoser(context) {
|
|
|
3917
3878
|
* @param node
|
|
3918
3879
|
*/
|
|
3919
3880
|
function* checkAnonymousFunction(node) {
|
|
3920
|
-
|
|
3881
|
+
env.enterScope(node);
|
|
3921
3882
|
if (node.params?.length) {
|
|
3922
3883
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.params, function* (node) {
|
|
3923
3884
|
yield* checkNode(node);
|
|
@@ -3926,7 +3887,7 @@ function createErrorDiagnoser(context) {
|
|
|
3926
3887
|
if (ensureNodeKeyExists(node, 'body')) {
|
|
3927
3888
|
yield* checkNode(node.body);
|
|
3928
3889
|
}
|
|
3929
|
-
|
|
3890
|
+
env.exitScope();
|
|
3930
3891
|
}
|
|
3931
3892
|
/**
|
|
3932
3893
|
* 检查 验证规则
|
|
@@ -4044,7 +4005,7 @@ function createErrorDiagnoser(context) {
|
|
|
4044
4005
|
function* dispatchNode(node) {
|
|
4045
4006
|
try {
|
|
4046
4007
|
// 调用表达式
|
|
4047
|
-
if ((0,
|
|
4008
|
+
if ((0, service_2.isNaslCallExpr)(node)) {
|
|
4048
4009
|
return yield* checkCallExpression(node);
|
|
4049
4010
|
}
|
|
4050
4011
|
const { concept } = node;
|
|
@@ -4407,8 +4368,10 @@ function createErrorDiagnoser(context) {
|
|
|
4407
4368
|
};
|
|
4408
4369
|
}
|
|
4409
4370
|
exports.createErrorDiagnoser = createErrorDiagnoser;
|
|
4410
|
-
|
|
4411
|
-
|
|
4371
|
+
function deduplicateDiagnostics(diagnostics) {
|
|
4372
|
+
return (0, lodash_1.uniqWith)(diagnostics, (a, b) => a.node === b.node && a.message === b.message);
|
|
4373
|
+
}
|
|
4374
|
+
const transformDiagnosticsToRecords = (fileNode, diagnostics, deduplication = true) => {
|
|
4412
4375
|
let filePath;
|
|
4413
4376
|
try {
|
|
4414
4377
|
filePath = fileNode.concept !== 'App' ? fileNode.getEmbeddedFilePath() : undefined;
|
|
@@ -4416,10 +4379,8 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4416
4379
|
catch (err) {
|
|
4417
4380
|
nasl_utils_1.isDebugMode && console.error(err);
|
|
4418
4381
|
}
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
const syntaxDiagnostics = [];
|
|
4422
|
-
//
|
|
4382
|
+
let semanticDiagnostics = [];
|
|
4383
|
+
let suggestionDiagnostics = [];
|
|
4423
4384
|
diagnostics.forEach((err, node) => {
|
|
4424
4385
|
if (err.length) {
|
|
4425
4386
|
err.forEach((item) => {
|
|
@@ -4432,17 +4393,25 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4432
4393
|
}
|
|
4433
4394
|
});
|
|
4434
4395
|
if (filePath) {
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4396
|
+
if (deduplication) {
|
|
4397
|
+
if (semanticDiagnostics.length) {
|
|
4398
|
+
semanticDiagnostics = deduplicateDiagnostics(semanticDiagnostics);
|
|
4399
|
+
}
|
|
4400
|
+
if (suggestionDiagnostics.length) {
|
|
4401
|
+
suggestionDiagnostics = deduplicateDiagnostics(suggestionDiagnostics);
|
|
4402
|
+
}
|
|
4403
|
+
}
|
|
4404
|
+
return [{
|
|
4405
|
+
filePath,
|
|
4406
|
+
id: fileNode.id,
|
|
4407
|
+
node: fileNode,
|
|
4408
|
+
semanticDiagnostics,
|
|
4409
|
+
suggestionDiagnostics,
|
|
4410
|
+
syntaxDiagnostics: [],
|
|
4411
|
+
message: '',
|
|
4412
|
+
}];
|
|
4413
|
+
}
|
|
4414
|
+
return [];
|
|
4446
4415
|
};
|
|
4447
4416
|
exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
|
|
4448
4417
|
// @ts-expect-error
|