@lcap/nasl-language-server-core 3.14.0-beta.1 → 3.14.0-beta.10
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 +218 -77
- package/out/checker.js.map +1 -1
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +20 -14
- package/out/reference-manager/builtin-q-name.js.map +1 -1
- package/out/reference-manager/collect-q-name.d.ts +15 -5
- package/out/reference-manager/collect-q-name.d.ts.map +1 -1
- package/out/reference-manager/collect-q-name.js +196 -63
- package/out/reference-manager/collect-q-name.js.map +1 -1
- package/out/reference-manager/get-q-name.d.ts +11 -0
- package/out/reference-manager/get-q-name.d.ts.map +1 -0
- package/out/reference-manager/get-q-name.js +213 -0
- package/out/reference-manager/get-q-name.js.map +1 -0
- package/out/reference-manager/reference-manager.d.ts +94 -92
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +797 -927
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/reference-manager/remove-q-name.d.ts +14 -4
- package/out/reference-manager/remove-q-name.d.ts.map +1 -1
- package/out/reference-manager/remove-q-name.js +159 -21
- package/out/reference-manager/remove-q-name.js.map +1 -1
- package/out/reference-manager/rename-q-name.d.ts +15 -4
- package/out/reference-manager/rename-q-name.d.ts.map +1 -1
- package/out/reference-manager/rename-q-name.js +118 -10
- package/out/reference-manager/rename-q-name.js.map +1 -1
- package/out/reference-manager/symbol-type.d.ts +21 -0
- package/out/reference-manager/symbol-type.d.ts.map +1 -0
- package/out/reference-manager/symbol-type.js +104 -0
- package/out/reference-manager/symbol-type.js.map +1 -0
- package/out/reference-manager/update-nasl-fragment.d.ts +51 -0
- package/out/reference-manager/update-nasl-fragment.d.ts.map +1 -0
- package/out/reference-manager/update-nasl-fragment.js +266 -0
- package/out/reference-manager/update-nasl-fragment.js.map +1 -0
- package/out/symbol/traverse/concepts/frontend/frontend.d.ts.map +1 -1
- package/out/symbol/traverse/concepts/frontend/frontend.js +0 -1
- package/out/symbol/traverse/concepts/frontend/frontend.js.map +1 -1
- package/out/symbol/traverse/concepts/utils.js +2 -2
- package/out/symbol/traverse/concepts/utils.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts +2 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +44 -32
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +45 -11
- package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +81 -22
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/component-def-manager/utils.d.ts.map +1 -1
- package/out/typer/component-def-manager/utils.js +56 -15
- 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 +72 -62
- package/out/typer/dispatch-all.js.map +1 -1
- package/out/typer/dispatch-def.d.ts +8 -3
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +163 -61
- package/out/typer/dispatch-def.js.map +1 -1
- package/out/typer/dispatch-expr.d.ts +6 -10
- package/out/typer/dispatch-expr.d.ts.map +1 -1
- package/out/typer/dispatch-expr.js +760 -552
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-process.d.ts +2 -5
- package/out/typer/dispatch-process.d.ts.map +1 -1
- package/out/typer/dispatch-process.js +120 -69
- package/out/typer/dispatch-process.js.map +1 -1
- package/out/typer/dispatch-stmt.d.ts +1 -0
- package/out/typer/dispatch-stmt.d.ts.map +1 -1
- package/out/typer/dispatch-stmt.js +49 -72
- package/out/typer/dispatch-stmt.js.map +1 -1
- package/out/typer/dispatch-view.d.ts +19 -7
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +554 -225
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/fix-use-before-assign.js +8 -8
- package/out/typer/fix-use-before-assign.js.map +1 -1
- package/out/typer/helper.d.ts +3 -2
- package/out/typer/helper.d.ts.map +1 -1
- package/out/typer/helper.js +7 -7
- package/out/typer/helper.js.map +1 -1
- package/out/typer/incremental-update.d.ts +7 -5
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +212 -144
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +6 -4
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +49 -52
- package/out/typer/index.js.map +1 -1
- package/out/typer/nasl-predicate.d.ts +8 -0
- package/out/typer/nasl-predicate.d.ts.map +1 -0
- package/out/typer/nasl-predicate.js +19 -0
- package/out/typer/nasl-predicate.js.map +1 -0
- package/out/typer/query-manager/query-manager.d.ts +28 -0
- package/out/typer/query-manager/query-manager.d.ts.map +1 -0
- package/out/typer/query-manager/query-manager.js +64 -0
- package/out/typer/query-manager/query-manager.js.map +1 -0
- package/out/typer/query-manager/query-tokens.d.ts +4 -0
- package/out/typer/query-manager/query-tokens.d.ts.map +1 -0
- package/out/typer/query-manager/query-tokens.js +8 -0
- package/out/typer/query-manager/query-tokens.js.map +1 -0
- package/out/typer/query-manager/type-level-evaluation-of.d.ts +13 -0
- package/out/typer/query-manager/type-level-evaluation-of.d.ts.map +1 -0
- package/out/typer/query-manager/type-level-evaluation-of.js +4 -0
- package/out/typer/query-manager/type-level-evaluation-of.js.map +1 -0
- package/out/typer/sem-diag.d.ts +5 -3
- package/out/typer/sem-diag.d.ts.map +1 -1
- package/out/typer/sem-diag.js +57 -15
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts +10 -9
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +77 -52
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts +11 -11
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +200 -228
- 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 +12 -10
- package/out/typer/topo-sort.js.map +1 -1
- package/out/typer/type-hint-manager/type-hint-manager.d.ts +39 -0
- package/out/typer/type-hint-manager/type-hint-manager.d.ts.map +1 -0
- package/out/typer/type-hint-manager/type-hint-manager.js +58 -0
- package/out/typer/type-hint-manager/type-hint-manager.js.map +1 -0
- package/out/typer/type-manager.d.ts +148 -0
- package/out/typer/type-manager.d.ts.map +1 -0
- package/out/typer/type-manager.js +762 -0
- package/out/typer/type-manager.js.map +1 -0
- package/out/typer/type-predicate.d.ts +72 -0
- package/out/typer/type-predicate.d.ts.map +1 -0
- package/out/typer/type-predicate.js +446 -0
- package/out/typer/type-predicate.js.map +1 -0
- package/out/typer/typer.d.ts +79 -22
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +238 -79
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts +23 -6
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +206 -117
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/bind-expression-hack.d.ts +2 -1
- package/out/utils/bind-expression-hack.d.ts.map +1 -1
- package/out/utils/bind-expression-hack.js +1 -1
- package/out/utils/bind-expression-hack.js.map +1 -1
- package/out/utils/error-boundary.d.ts.map +1 -1
- package/out/utils/error-boundary.js +7 -3
- package/out/utils/error-boundary.js.map +1 -1
- package/out/utils/fp-macros.d.ts +16 -0
- package/out/utils/fp-macros.d.ts.map +1 -0
- package/out/utils/fp-macros.js +82 -0
- package/out/utils/fp-macros.js.map +1 -0
- package/out/utils/nasl-type-manipulation.d.ts +29 -0
- package/out/utils/nasl-type-manipulation.d.ts.map +1 -0
- package/out/utils/nasl-type-manipulation.js +78 -0
- package/out/utils/nasl-type-manipulation.js.map +1 -0
- package/out/utils/parseTsClassType.d.ts +2 -2
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +89 -73
- package/out/utils/parseTsClassType.js.map +1 -1
- package/out/utils/reference-hack.d.ts +4 -0
- package/out/utils/reference-hack.d.ts.map +1 -0
- package/out/utils/reference-hack.js +14 -0
- package/out/utils/reference-hack.js.map +1 -0
- package/out/utils/type-operator.d.ts +29 -0
- package/out/utils/type-operator.d.ts.map +1 -0
- package/out/utils/type-operator.js +123 -0
- package/out/utils/type-operator.js.map +1 -0
- package/package.json +9 -5
- package/out/typer/typeManager.d.ts +0 -91
- package/out/typer/typeManager.d.ts.map +0 -1
- package/out/typer/typeManager.js +0 -839
- package/out/typer/typeManager.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 { SemEnv } from './typer';
|
|
3
|
+
import { type SemEnv } from './typer';
|
|
4
4
|
export declare enum Severity {
|
|
5
5
|
WARN = "warning",
|
|
6
6
|
ERROR = "error"
|
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;
|
|
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,EAEpF,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAKhE,oBAAY,QAAQ;IAClB,IAAI,YAAY;IAChB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,UAAU;IAEzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,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;AAuPF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,eAAe;oCA07HpB,OAAO;sDAPW,gBAAgB,EAAE;;;;sBAfjD,UAAU,GAAG,SAAS;;;6BAqChB,UAAU;2BAsBZ,UAAU;kBA/7HnB,UAAU,WAAW,MAAM,YAAY,YAAY;EA+8HzE;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;AAED,eAAO,MAAM,6BAA6B,aAAc,UAAU,sCAAoC,MAAM,gBAAgB,CAmC3H,CAAA"}
|
package/out/checker.js
CHANGED
|
@@ -6,6 +6,9 @@ const nasl_concepts_1 = require("@lcap/nasl-concepts");
|
|
|
6
6
|
const service_1 = require("@lcap/nasl-concepts/service");
|
|
7
7
|
const nasl_utils_1 = require("@lcap/nasl-utils");
|
|
8
8
|
const typer_1 = require("./typer");
|
|
9
|
+
const type_predicate_1 = require("./typer/type-predicate");
|
|
10
|
+
const type_manager_1 = require("./typer/type-manager");
|
|
11
|
+
const nasl_predicate_1 = require("./typer/nasl-predicate");
|
|
9
12
|
var Severity;
|
|
10
13
|
(function (Severity) {
|
|
11
14
|
Severity["WARN"] = "warning";
|
|
@@ -38,6 +41,12 @@ function isControlFlowNode(node) {
|
|
|
38
41
|
function isCallExpression(node) {
|
|
39
42
|
return nasl_concepts_1.asserts.isCallFunction(node) || nasl_concepts_1.asserts.isCallInterface(node) || nasl_concepts_1.asserts.isCallLogic(node) || nasl_concepts_1.asserts.isCallConnector(node) || nasl_concepts_1.asserts.isCallEvent(node);
|
|
40
43
|
}
|
|
44
|
+
const isEnd = (node) => node.concept === 'End';
|
|
45
|
+
const isAbort = (node) => node.concept === 'Abort';
|
|
46
|
+
const isBreak = (node) => node.concept === 'Break';
|
|
47
|
+
const isContinue = (node) => node.concept === 'Continue';
|
|
48
|
+
const fastIsControlFlowNode = (node) => isEnd(node) || isAbort(node) || isBreak(node) || isContinue(node);
|
|
49
|
+
const isArgument = (node) => node.concept === 'Argument';
|
|
41
50
|
function getExpressionNodeName(concept) {
|
|
42
51
|
const expressionNodeName = {
|
|
43
52
|
CallFunction: '内置函数',
|
|
@@ -250,8 +259,9 @@ function createErrorDiagnoser(context) {
|
|
|
250
259
|
const diagnosticMap = new Map();
|
|
251
260
|
// 文件级别节点
|
|
252
261
|
const fileNodes = [];
|
|
253
|
-
let inPlayground =
|
|
262
|
+
let inPlayground = 0;
|
|
254
263
|
let inAuthLogic = false;
|
|
264
|
+
let dbType = '';
|
|
255
265
|
let curVarCounter = 0;
|
|
256
266
|
/**
|
|
257
267
|
* 获取当前文件节点
|
|
@@ -276,7 +286,7 @@ function createErrorDiagnoser(context) {
|
|
|
276
286
|
if (diagnostics) {
|
|
277
287
|
const diagnostic = {
|
|
278
288
|
message,
|
|
279
|
-
severity: inPlayground ? Severity.WARN : severity ?? Severity.ERROR,
|
|
289
|
+
severity: inPlayground > 0 ? Severity.WARN : (severity ?? Severity.ERROR),
|
|
280
290
|
...others,
|
|
281
291
|
};
|
|
282
292
|
if (isDebug) {
|
|
@@ -314,7 +324,7 @@ function createErrorDiagnoser(context) {
|
|
|
314
324
|
*/
|
|
315
325
|
function getStatusOfSharedApp(sharedApp) {
|
|
316
326
|
const version = latestVersionsOfSharedApp?.find((item) => item.name === sharedApp.name && item.provider === sharedApp.provider);
|
|
317
|
-
if (!version) {
|
|
327
|
+
if (!version || !version.version) {
|
|
318
328
|
return 'delete';
|
|
319
329
|
}
|
|
320
330
|
else if (version.version !== sharedApp.version) {
|
|
@@ -441,6 +451,15 @@ function createErrorDiagnoser(context) {
|
|
|
441
451
|
message = 'SQL查询:语句不能为空。';
|
|
442
452
|
}
|
|
443
453
|
else if (nasl_concepts_1.asserts.isDestination(node)) {
|
|
454
|
+
chkDest(node);
|
|
455
|
+
}
|
|
456
|
+
else if (node.concept === 'Argument' && nasl_concepts_1.asserts.isDestination(node.parentNode)) {
|
|
457
|
+
chkDest(node.parentNode);
|
|
458
|
+
}
|
|
459
|
+
if (message) {
|
|
460
|
+
error(node, message);
|
|
461
|
+
}
|
|
462
|
+
function chkDest(node) {
|
|
444
463
|
const processElement = node.getAncestor('ProcessElementV2') ?? node.getAncestor('ProcessElement');
|
|
445
464
|
if (processElement) {
|
|
446
465
|
message = '任务未关联页面';
|
|
@@ -450,9 +469,6 @@ function createErrorDiagnoser(context) {
|
|
|
450
469
|
message = '';
|
|
451
470
|
}
|
|
452
471
|
}
|
|
453
|
-
if (message) {
|
|
454
|
-
error(node, message);
|
|
455
|
-
}
|
|
456
472
|
}
|
|
457
473
|
/**
|
|
458
474
|
* 创建一个未找到定义的实体的错误信息
|
|
@@ -577,14 +593,11 @@ function createErrorDiagnoser(context) {
|
|
|
577
593
|
*/
|
|
578
594
|
function getMinArgsCount(params) {
|
|
579
595
|
const paramLen = params?.length;
|
|
580
|
-
let minArgsCount =
|
|
581
|
-
for (let i =
|
|
596
|
+
let minArgsCount = 0;
|
|
597
|
+
for (let i = 0; i < paramLen; i++) {
|
|
582
598
|
const param = params[i];
|
|
583
|
-
if (isNonRequiredParam(param)) {
|
|
584
|
-
minArgsCount
|
|
585
|
-
}
|
|
586
|
-
else { // 如果参数有默认值,则跳过
|
|
587
|
-
break;
|
|
599
|
+
if (!isNonRequiredParam(param)) {
|
|
600
|
+
minArgsCount++; // 如果参数有默认值,则跳过
|
|
588
601
|
}
|
|
589
602
|
}
|
|
590
603
|
return minArgsCount;
|
|
@@ -688,10 +701,12 @@ function createErrorDiagnoser(context) {
|
|
|
688
701
|
* @param ref
|
|
689
702
|
*/
|
|
690
703
|
function* checkCallExpressionParameters(node, ref) {
|
|
691
|
-
|
|
704
|
+
// Handle both TypeAnnotation and FunctionDefinition formats
|
|
705
|
+
const params = ref.params ?? ref.typeArguments;
|
|
692
706
|
const { arguments: args } = node;
|
|
693
707
|
const paramsLen = params?.length || 0;
|
|
694
708
|
const argsLen = args?.length || 0;
|
|
709
|
+
// For FunctionDefinition format, check spread and optional params
|
|
695
710
|
const spreadParamIndex = params?.findIndex((param) => param.spread);
|
|
696
711
|
const hasSpreadParam = spreadParamIndex !== -1;
|
|
697
712
|
const minArgsCount = getMinArgsCount(params);
|
|
@@ -702,18 +717,19 @@ function createErrorDiagnoser(context) {
|
|
|
702
717
|
error(node, `预期 ${minArgsCount} 个参数,但传入了 ${argsLen} 个。`);
|
|
703
718
|
}
|
|
704
719
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(args, function* (arg, index) {
|
|
705
|
-
arg.paramRequired = true;
|
|
706
720
|
const param = params?.[index];
|
|
707
|
-
if (
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
721
|
+
if (!param)
|
|
722
|
+
return;
|
|
723
|
+
const isParamRequired = !(hasSpreadParam && index > spreadParamIndex) && !isNonRequiredParam(param);
|
|
724
|
+
arg.paramRequired = isParamRequired;
|
|
725
|
+
const paramType = param.typeAnnotation ??
|
|
726
|
+
(nasl_concepts_1.asserts.isTypeAnnotation(param) ? param : env.getType(param));
|
|
711
727
|
const argType = yield* checkNode(arg);
|
|
712
728
|
if (paramType?.typeKind === 'function' && argType?.typeKind === 'function') {
|
|
713
729
|
const argTypeArgs = argType?.typeArguments || [];
|
|
714
730
|
const paramTypeArgs = paramType?.typeArguments || [];
|
|
715
|
-
if (argTypeArgs
|
|
716
|
-
error(node, `高阶函数: 参数个数不匹配,期望 ${paramTypeArgs.length} 个, 实际传入 ${argTypeArgs
|
|
731
|
+
if (argTypeArgs.length !== paramTypeArgs.length) {
|
|
732
|
+
error(node, `高阶函数: 参数个数不匹配,期望 ${paramTypeArgs.length} 个, 实际传入 ${argTypeArgs.length} 个!`);
|
|
717
733
|
}
|
|
718
734
|
}
|
|
719
735
|
});
|
|
@@ -724,7 +740,7 @@ function createErrorDiagnoser(context) {
|
|
|
724
740
|
*/
|
|
725
741
|
function* checkVariableType(node) {
|
|
726
742
|
const type = env.getType(node);
|
|
727
|
-
if (
|
|
743
|
+
if (isUnresolvedType(type)) {
|
|
728
744
|
const logic = node.getAncestor('SubLogic') || node.getAncestor('Logic');
|
|
729
745
|
let used = false;
|
|
730
746
|
logic.traverseStrictChildren((item) => {
|
|
@@ -781,19 +797,20 @@ function createErrorDiagnoser(context) {
|
|
|
781
797
|
*/
|
|
782
798
|
function* checkPlayground(playground) {
|
|
783
799
|
if (playground?.length) {
|
|
784
|
-
inPlayground
|
|
800
|
+
inPlayground++;
|
|
785
801
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(playground, function* (node) {
|
|
786
802
|
yield* checkNode(node);
|
|
787
803
|
});
|
|
788
|
-
inPlayground
|
|
804
|
+
inPlayground--;
|
|
789
805
|
}
|
|
790
806
|
}
|
|
791
807
|
/**
|
|
792
808
|
* 未推导出的类型
|
|
809
|
+
* 这个可能有问题,因为可能是 type 的嵌套结构没有推导出类型,看使用场景了
|
|
793
810
|
* @param type
|
|
794
811
|
* @returns
|
|
795
812
|
*/
|
|
796
|
-
function
|
|
813
|
+
function isUnresolvedType(type) {
|
|
797
814
|
return !type || type?.typeKind === 'typeParam' || type?.typeName === 'Null' || type?.typeName === 'void';
|
|
798
815
|
}
|
|
799
816
|
/**
|
|
@@ -803,9 +820,14 @@ function createErrorDiagnoser(context) {
|
|
|
803
820
|
*/
|
|
804
821
|
function* checkNonNullExpression(node) {
|
|
805
822
|
const type = yield* checkNode(node);
|
|
806
|
-
if (
|
|
823
|
+
if (isUnresolvedType(type)) {
|
|
807
824
|
const scope = node?.constructor?.nodeTitle;
|
|
808
|
-
|
|
825
|
+
if (node.concept === 'Identifier') {
|
|
826
|
+
error(node, `${scope}:${node.name} 未定义。`);
|
|
827
|
+
}
|
|
828
|
+
else {
|
|
829
|
+
error(node, `${scope}:所选择的内容未定义。`);
|
|
830
|
+
}
|
|
809
831
|
return errorType;
|
|
810
832
|
}
|
|
811
833
|
return type;
|
|
@@ -1136,7 +1158,8 @@ function createErrorDiagnoser(context) {
|
|
|
1136
1158
|
*/
|
|
1137
1159
|
function* checkVariable(node) {
|
|
1138
1160
|
yield* checkNode(node.defaultValue);
|
|
1139
|
-
|
|
1161
|
+
// 前面加了报错,省点时间,报错不用那么精确
|
|
1162
|
+
// yield* checkVariableType(node);
|
|
1140
1163
|
}
|
|
1141
1164
|
/**
|
|
1142
1165
|
* 检查 前端全局变量
|
|
@@ -1178,6 +1201,7 @@ function createErrorDiagnoser(context) {
|
|
|
1178
1201
|
* @param node
|
|
1179
1202
|
*/
|
|
1180
1203
|
function* checkDataSource(node) {
|
|
1204
|
+
dbType = node.dataSourceSqlType;
|
|
1181
1205
|
if (node.entities?.length) {
|
|
1182
1206
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.entities, function* (node) {
|
|
1183
1207
|
yield* checkNode(node);
|
|
@@ -1230,6 +1254,7 @@ function createErrorDiagnoser(context) {
|
|
|
1230
1254
|
if (duplidateEntities.length) {
|
|
1231
1255
|
error(node, `数据源${node.name}存在重名实体:${duplidateEntities.join(', ')}`);
|
|
1232
1256
|
}
|
|
1257
|
+
dbType = '';
|
|
1233
1258
|
}
|
|
1234
1259
|
/**
|
|
1235
1260
|
* 检查 实体
|
|
@@ -1254,6 +1279,69 @@ function createErrorDiagnoser(context) {
|
|
|
1254
1279
|
error(node, '共享范围为指定应用时,必须指定共享应用');
|
|
1255
1280
|
}
|
|
1256
1281
|
}
|
|
1282
|
+
function getCurrentDataBaseType(node) {
|
|
1283
|
+
if (node.databaseTypeAnnotation) {
|
|
1284
|
+
const databaseTypeMap = node.dataBaseTypeMap || {};
|
|
1285
|
+
const { typeName } = node.databaseTypeAnnotation;
|
|
1286
|
+
return databaseTypeMap[typeName];
|
|
1287
|
+
}
|
|
1288
|
+
const { typeName } = node.typeAnnotation;
|
|
1289
|
+
if (typeName === 'String') {
|
|
1290
|
+
const defaultDataBaseName = getInferredDefaultDataBaseName(node);
|
|
1291
|
+
if (defaultDataBaseName && defaultDataBaseName !== node.defaultDataBaseType?.type) {
|
|
1292
|
+
return {
|
|
1293
|
+
...(node.dataBaseTypeMap?.[defaultDataBaseName] ?? {}),
|
|
1294
|
+
};
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
return node.defaultDataBaseType;
|
|
1298
|
+
}
|
|
1299
|
+
function getInferredDefaultDataBaseName(ndoe) {
|
|
1300
|
+
let defaultDataBaseName;
|
|
1301
|
+
const { typeName } = ndoe.typeAnnotation;
|
|
1302
|
+
if (typeName === 'String') {
|
|
1303
|
+
const dataSourceSqlType = dbType;
|
|
1304
|
+
let maxLength;
|
|
1305
|
+
const { rules } = ndoe;
|
|
1306
|
+
if (Array.isArray(rules)) {
|
|
1307
|
+
// 是否需要更新规则
|
|
1308
|
+
rules.forEach((rule) => {
|
|
1309
|
+
const match = rule.match(/^([^()]+)\(([\d\-.]+)\)$/);
|
|
1310
|
+
if (match) {
|
|
1311
|
+
const [, key, value] = match;
|
|
1312
|
+
if (key === 'maxLength') {
|
|
1313
|
+
maxLength = value;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
}
|
|
1318
|
+
// 不同数据库 最大长度 短、中、长 对应的默认储存类型
|
|
1319
|
+
const sqlMap = {
|
|
1320
|
+
mysql: {
|
|
1321
|
+
255: 'varchar',
|
|
1322
|
+
4000: 'text',
|
|
1323
|
+
16777215: 'mediumtext',
|
|
1324
|
+
},
|
|
1325
|
+
oracle: {
|
|
1326
|
+
255: 'varchar2',
|
|
1327
|
+
4000: 'clob',
|
|
1328
|
+
16777215: 'clob',
|
|
1329
|
+
},
|
|
1330
|
+
dameng: {
|
|
1331
|
+
255: 'varchar2',
|
|
1332
|
+
4000: 'text',
|
|
1333
|
+
16777215: 'text',
|
|
1334
|
+
},
|
|
1335
|
+
db2: {
|
|
1336
|
+
255: 'varchar',
|
|
1337
|
+
4000: 'clob',
|
|
1338
|
+
16777215: 'clob',
|
|
1339
|
+
},
|
|
1340
|
+
};
|
|
1341
|
+
defaultDataBaseName = sqlMap?.[dataSourceSqlType]?.[maxLength];
|
|
1342
|
+
}
|
|
1343
|
+
return defaultDataBaseName;
|
|
1344
|
+
}
|
|
1257
1345
|
/**
|
|
1258
1346
|
* 检查 实体属性
|
|
1259
1347
|
* @param node
|
|
@@ -1262,7 +1350,6 @@ function createErrorDiagnoser(context) {
|
|
|
1262
1350
|
yield* checkNode(node.defaultValue);
|
|
1263
1351
|
yield* checkNode(node.typeAnnotation);
|
|
1264
1352
|
const entity = node.getAncestor('Entity');
|
|
1265
|
-
const dbType = entity.dataSource.dataSourceSqlType;
|
|
1266
1353
|
const { origin } = entity || {};
|
|
1267
1354
|
if (dbType && !['excel', 'table'].includes(origin)) {
|
|
1268
1355
|
const { typeAnnotation, databaseTypeAnnotation, rules } = node;
|
|
@@ -1277,7 +1364,7 @@ function createErrorDiagnoser(context) {
|
|
|
1277
1364
|
});
|
|
1278
1365
|
}
|
|
1279
1366
|
let message = '';
|
|
1280
|
-
const dataBaseTyp = node
|
|
1367
|
+
const dataBaseTyp = getCurrentDataBaseType(node);
|
|
1281
1368
|
if (!dataBaseTyp && databaseTypeAnnotation) {
|
|
1282
1369
|
const { typeName: databaseTypeName } = databaseTypeAnnotation;
|
|
1283
1370
|
const errorMsg = `平台目前暂不支持${dbType}数据库的${databaseTypeName}存储类型`;
|
|
@@ -1414,7 +1501,9 @@ function createErrorDiagnoser(context) {
|
|
|
1414
1501
|
const value = numeric.value;
|
|
1415
1502
|
const decimalPlaces = value?.split('.')[1]?.length || 0;
|
|
1416
1503
|
if (decimalPlaces > +scale) {
|
|
1417
|
-
error(node, `实体字段${node.name}默认值的小数位数不能大于设置的小数位数${scale}
|
|
1504
|
+
error(node, `实体字段${node.name}默认值的小数位数不能大于设置的小数位数${scale},否则将会按照小数位数自动截断`, {
|
|
1505
|
+
severity: Severity.WARN,
|
|
1506
|
+
});
|
|
1418
1507
|
}
|
|
1419
1508
|
}
|
|
1420
1509
|
break;
|
|
@@ -1591,7 +1680,8 @@ function createErrorDiagnoser(context) {
|
|
|
1591
1680
|
*/
|
|
1592
1681
|
function* checkReturn(node) {
|
|
1593
1682
|
yield* checkNode(node.defaultValue);
|
|
1594
|
-
|
|
1683
|
+
// 前面加了报错,省点时间,报错不用那么精确
|
|
1684
|
+
// yield* checkVariableType(node);
|
|
1595
1685
|
}
|
|
1596
1686
|
/**
|
|
1597
1687
|
* 检查 接口
|
|
@@ -1822,6 +1912,10 @@ function createErrorDiagnoser(context) {
|
|
|
1822
1912
|
* @param node
|
|
1823
1913
|
*/
|
|
1824
1914
|
function* checkViewElement(node) {
|
|
1915
|
+
// lcap-login 组件需要完全不做任何检查,不报任何错误。里面一大堆脏数据。
|
|
1916
|
+
if (node.tag === 'lcap-login') {
|
|
1917
|
+
return;
|
|
1918
|
+
}
|
|
1825
1919
|
const shouldProvideCurrentCtx = !!(node.slotScope);
|
|
1826
1920
|
let unbindVariables;
|
|
1827
1921
|
if (shouldProvideCurrentCtx) {
|
|
@@ -1875,10 +1969,9 @@ function createErrorDiagnoser(context) {
|
|
|
1875
1969
|
const isTempWarningMode = node.parentNode?.concept === 'ViewElement' &&
|
|
1876
1970
|
node.parentNode?.tag === 'u-table-view-expander';
|
|
1877
1971
|
if (isTempWarningMode) {
|
|
1878
|
-
|
|
1879
|
-
inPlayground = true;
|
|
1972
|
+
inPlayground++;
|
|
1880
1973
|
yield* checkNode(node.expression);
|
|
1881
|
-
inPlayground
|
|
1974
|
+
inPlayground--;
|
|
1882
1975
|
}
|
|
1883
1976
|
else {
|
|
1884
1977
|
yield* checkNode(node.expression);
|
|
@@ -1929,7 +2022,9 @@ function createErrorDiagnoser(context) {
|
|
|
1929
2022
|
if (processElement || node.type === 'dynamic') {
|
|
1930
2023
|
yield* checkNode(node.destination);
|
|
1931
2024
|
}
|
|
1932
|
-
|
|
2025
|
+
if (node.name === 'externalDestination' && node.type === 'dynamic') {
|
|
2026
|
+
yield* checkNode(node.externalDestination);
|
|
2027
|
+
}
|
|
1933
2028
|
if (node.rules?.length) {
|
|
1934
2029
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.rules, function* (node) {
|
|
1935
2030
|
yield* checkNode(node);
|
|
@@ -2019,7 +2114,7 @@ function createErrorDiagnoser(context) {
|
|
|
2019
2114
|
error(node, '流程暂不支持可变参数');
|
|
2020
2115
|
}
|
|
2021
2116
|
if (node.includeTypeArgs) {
|
|
2022
|
-
error(node, '
|
|
2117
|
+
error(node, '流程暂不支持泛型参数');
|
|
2023
2118
|
}
|
|
2024
2119
|
const unbindVariables = env.temporarilyBindVariables([
|
|
2025
2120
|
...(node?.params || []),
|
|
@@ -2133,7 +2228,7 @@ function createErrorDiagnoser(context) {
|
|
|
2133
2228
|
error(node, '流程暂不支持可变参数');
|
|
2134
2229
|
}
|
|
2135
2230
|
if (node.includeTypeArgs) {
|
|
2136
|
-
error(node, '
|
|
2231
|
+
error(node, '流程暂不支持泛型参数');
|
|
2137
2232
|
}
|
|
2138
2233
|
}
|
|
2139
2234
|
/**
|
|
@@ -2221,6 +2316,8 @@ function createErrorDiagnoser(context) {
|
|
|
2221
2316
|
yield* checkNode(node);
|
|
2222
2317
|
});
|
|
2223
2318
|
}
|
|
2319
|
+
// 无人审批策略
|
|
2320
|
+
yield* checkNode(node.unmannedApprovalStrategy);
|
|
2224
2321
|
if (node.fieldPermissions?.length) {
|
|
2225
2322
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.fieldPermissions, function* (node) {
|
|
2226
2323
|
yield* checkNode(node);
|
|
@@ -2239,6 +2336,40 @@ function createErrorDiagnoser(context) {
|
|
|
2239
2336
|
}
|
|
2240
2337
|
unbindVariables();
|
|
2241
2338
|
}
|
|
2339
|
+
/**
|
|
2340
|
+
* 检查 无人时,自动转派审批策略
|
|
2341
|
+
* @param node
|
|
2342
|
+
*/
|
|
2343
|
+
function* checkReassignUnmannedV2(node) {
|
|
2344
|
+
return yield* checkNode(node.assignees);
|
|
2345
|
+
}
|
|
2346
|
+
/**
|
|
2347
|
+
* 检查 用户经办人
|
|
2348
|
+
* @param node
|
|
2349
|
+
*/
|
|
2350
|
+
function* checkUserAssignees(node) {
|
|
2351
|
+
if (!node.users?.length) {
|
|
2352
|
+
error(node, '转派人员为空');
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
/**
|
|
2356
|
+
* 检查 角色经办人
|
|
2357
|
+
* @param node
|
|
2358
|
+
*/
|
|
2359
|
+
function* checkRoleAssignees(node) {
|
|
2360
|
+
if (!node.roles?.length) {
|
|
2361
|
+
error(node, '转派角色为空');
|
|
2362
|
+
}
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* 检查 部门经办人
|
|
2366
|
+
* @param node
|
|
2367
|
+
*/
|
|
2368
|
+
function* checkDepartmentAssignees(node) {
|
|
2369
|
+
if (!node.departments?.length) {
|
|
2370
|
+
error(node, '转派部门为空');
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2242
2373
|
/**
|
|
2243
2374
|
* 检查 字段权限控制详情
|
|
2244
2375
|
* @param node
|
|
@@ -2362,7 +2493,7 @@ function createErrorDiagnoser(context) {
|
|
|
2362
2493
|
if (logicReturns[0].name !== itfReturns[0].name) {
|
|
2363
2494
|
isSame = false;
|
|
2364
2495
|
}
|
|
2365
|
-
else if (!(
|
|
2496
|
+
else if (!(0, type_predicate_1.isEqualTy)(env, env.getType(logicReturns[0]), env.getType(itfReturns[0]))) {
|
|
2366
2497
|
isSame = false;
|
|
2367
2498
|
}
|
|
2368
2499
|
}
|
|
@@ -2574,8 +2705,14 @@ function createErrorDiagnoser(context) {
|
|
|
2574
2705
|
if (!ensureNodeKeyExists(node, 'calleeName')) {
|
|
2575
2706
|
return;
|
|
2576
2707
|
}
|
|
2577
|
-
const ref = env.
|
|
2578
|
-
|
|
2708
|
+
const ref = env.resolvedCallInfo.get(node) ?? env.resolveRef(node);
|
|
2709
|
+
// Handle the new FunctionDefinition structure
|
|
2710
|
+
if (ref?.params && !(0, type_manager_1.hasUnresolvedTyInCallInfo)(ref)) {
|
|
2711
|
+
// It's a FunctionDefinition object
|
|
2712
|
+
yield* checkScopeOfUse(node, ref);
|
|
2713
|
+
yield* checkCallExpressionParameters(node, ref);
|
|
2714
|
+
}
|
|
2715
|
+
else if (ref && !(0, type_predicate_1.isUnResolvedTy)(ref)) {
|
|
2579
2716
|
// 检查使用范围
|
|
2580
2717
|
yield* checkScopeOfUse(node, ref);
|
|
2581
2718
|
yield* checkCallExpressionParameters(node, ref);
|
|
@@ -2631,7 +2768,7 @@ function createErrorDiagnoser(context) {
|
|
|
2631
2768
|
node.parentKey !== 'consequent' &&
|
|
2632
2769
|
node.parentNode?.parentNode?.concept !== 'CallInterface' &&
|
|
2633
2770
|
node.parentNode.concept !== 'Block' &&
|
|
2634
|
-
|
|
2771
|
+
isUnresolvedType(type)) {
|
|
2635
2772
|
let showErr = false;
|
|
2636
2773
|
if (node.parentNode?.parentNode?.concept === 'CallLogic') {
|
|
2637
2774
|
// calllogic 中别的类型会强校验,但是内置函数,不会强制校验,下面这几个其实是走的内置函数的实现,所以需要手动增加一下校验
|
|
@@ -2910,7 +3047,7 @@ function createErrorDiagnoser(context) {
|
|
|
2910
3047
|
* @param node
|
|
2911
3048
|
*/
|
|
2912
3049
|
function* checkMatchCase(node) {
|
|
2913
|
-
const match = node.getAncestor('Match');
|
|
3050
|
+
const match = toRaw(node.getAncestor('Match'));
|
|
2914
3051
|
if (node.patterns?.length) {
|
|
2915
3052
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.patterns, function* (node) {
|
|
2916
3053
|
yield* checkNode(node);
|
|
@@ -2923,7 +3060,7 @@ function createErrorDiagnoser(context) {
|
|
|
2923
3060
|
// 先使用ts原始的报错,这个先注释掉
|
|
2924
3061
|
if (nasl_concepts_1.asserts.isTypeAnnotation(node) && matchExpressionType?.typeKind === 'union') {
|
|
2925
3062
|
(0, service_1.transformUnionTypeAnnotation)(matchExpressionType, match?.app);
|
|
2926
|
-
const haveType = matchExpressionType?.typeArguments
|
|
3063
|
+
const haveType = !!matchExpressionType?.typeArguments?.some(item => env.isEq(item, node));
|
|
2927
3064
|
if (!haveType) {
|
|
2928
3065
|
message = '匹配:选择类型不存在';
|
|
2929
3066
|
titleTip = '该类型已被删除';
|
|
@@ -3050,19 +3187,25 @@ function createErrorDiagnoser(context) {
|
|
|
3050
3187
|
? getPropertyOfType(node.parentNode.typeAnnotation, node.name)
|
|
3051
3188
|
: env.resolveRef(node);
|
|
3052
3189
|
if (!ref) {
|
|
3053
|
-
if (node.
|
|
3190
|
+
if (node.namespace === 'backend') {
|
|
3191
|
+
/**
|
|
3192
|
+
* 参考类型检查器的 {@link tpIdentifier}方法
|
|
3193
|
+
*/
|
|
3194
|
+
return typer_1.naslLongTy;
|
|
3195
|
+
}
|
|
3196
|
+
else if (node.name === 'it') {
|
|
3054
3197
|
return env.getType(node);
|
|
3055
3198
|
}
|
|
3056
3199
|
else {
|
|
3057
3200
|
const { name } = node;
|
|
3058
3201
|
// 之前有一些脏数据,先兼容
|
|
3059
|
-
if (['true', 'false'].includes(name)) {
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
}
|
|
3202
|
+
// if (['true', 'false'].includes(name)) {
|
|
3203
|
+
// return new TypeAnnotation({
|
|
3204
|
+
// typeKind: 'primitive',
|
|
3205
|
+
// typeName: 'Boolean',
|
|
3206
|
+
// typeNamespace: 'nasl.core',
|
|
3207
|
+
// });
|
|
3208
|
+
// }
|
|
3066
3209
|
if (
|
|
3067
3210
|
// name 是 A.B.C
|
|
3068
3211
|
name?.split('.')?.length > 1
|
|
@@ -3232,7 +3375,7 @@ function createErrorDiagnoser(context) {
|
|
|
3232
3375
|
const prop = getPropertyOfType(type, propertyName);
|
|
3233
3376
|
if (prop) {
|
|
3234
3377
|
const propertyType = yield* checkNode(property);
|
|
3235
|
-
if (
|
|
3378
|
+
if (isUnresolvedType(propertyType)) {
|
|
3236
3379
|
error(node, `${property.name}推导不出类型!请连线或手动设置`);
|
|
3237
3380
|
}
|
|
3238
3381
|
else if (type.typeKind === 'anonymousStructure') {
|
|
@@ -3597,20 +3740,6 @@ function createErrorDiagnoser(context) {
|
|
|
3597
3740
|
if (ensureNodeKeyExists(node, 'argument')) {
|
|
3598
3741
|
yield* checkNode(node.argument);
|
|
3599
3742
|
}
|
|
3600
|
-
if (node.operator === 'isNull' && !!node.getAncestor('CallQueryComponent')) {
|
|
3601
|
-
function useVariable(node) {
|
|
3602
|
-
let res = false;
|
|
3603
|
-
node.traverseStrictChildren((child) => {
|
|
3604
|
-
if (child.concept === 'Identifier' && child.namespace !== 'inner') {
|
|
3605
|
-
res = true;
|
|
3606
|
-
}
|
|
3607
|
-
});
|
|
3608
|
-
return res;
|
|
3609
|
-
}
|
|
3610
|
-
if (useVariable(node)) {
|
|
3611
|
-
error(node, '空值匹配组件暂不支持使用变量');
|
|
3612
|
-
}
|
|
3613
|
-
}
|
|
3614
3743
|
return env.getType(node);
|
|
3615
3744
|
}
|
|
3616
3745
|
/**
|
|
@@ -3693,7 +3822,7 @@ function createErrorDiagnoser(context) {
|
|
|
3693
3822
|
if (ensureNodeKeyExists(node, 'typeName') && node.typeKind === 'reference') {
|
|
3694
3823
|
const ref = env.resolveRef(node);
|
|
3695
3824
|
if (!ref) {
|
|
3696
|
-
error(node,
|
|
3825
|
+
error(node, `找不到类型 ${node.typeName}`);
|
|
3697
3826
|
}
|
|
3698
3827
|
}
|
|
3699
3828
|
}
|
|
@@ -3729,12 +3858,8 @@ function createErrorDiagnoser(context) {
|
|
|
3729
3858
|
}
|
|
3730
3859
|
function* dispatchNode(node) {
|
|
3731
3860
|
try {
|
|
3732
|
-
// 控制流节点
|
|
3733
|
-
if (isControlFlowNode(node)) {
|
|
3734
|
-
return yield* checkControlFlowNode(node);
|
|
3735
|
-
}
|
|
3736
3861
|
// 调用表达式
|
|
3737
|
-
if (
|
|
3862
|
+
if ((0, nasl_predicate_1.isNaslCallExpr)(node)) {
|
|
3738
3863
|
return yield* checkCallExpression(node);
|
|
3739
3864
|
}
|
|
3740
3865
|
const { concept } = node;
|
|
@@ -3841,6 +3966,14 @@ function createErrorDiagnoser(context) {
|
|
|
3841
3966
|
return yield* checkProcessDefinitionV2(node);
|
|
3842
3967
|
case 'ProcessElementV2':
|
|
3843
3968
|
return yield* checkProcessElementV2(node);
|
|
3969
|
+
case 'ReassignUnmannedV2':
|
|
3970
|
+
return yield* checkReassignUnmannedV2(node);
|
|
3971
|
+
case 'UserAssignees':
|
|
3972
|
+
return yield* checkUserAssignees(node);
|
|
3973
|
+
case 'RoleAssignees':
|
|
3974
|
+
return yield* checkRoleAssignees(node);
|
|
3975
|
+
case 'DepartmentAssignees':
|
|
3976
|
+
return yield* checkDepartmentAssignees(node);
|
|
3844
3977
|
case 'FieldPermissionV2':
|
|
3845
3978
|
return yield* checkFieldPermissionV2(node);
|
|
3846
3979
|
case 'MsgTriggerLauncher':
|
|
@@ -3954,9 +4087,13 @@ function createErrorDiagnoser(context) {
|
|
|
3954
4087
|
case 'Start':
|
|
3955
4088
|
return;
|
|
3956
4089
|
case 'SqlQueryComponent':
|
|
3957
|
-
return;
|
|
4090
|
+
return env.getType(node);
|
|
3958
4091
|
default:
|
|
3959
|
-
|
|
4092
|
+
// isDebugMode && console.log(node);
|
|
4093
|
+
}
|
|
4094
|
+
// 控制流节点,低频或没啥人用的东西放后面判断
|
|
4095
|
+
if (fastIsControlFlowNode(node)) {
|
|
4096
|
+
return yield* checkControlFlowNode(node);
|
|
3960
4097
|
}
|
|
3961
4098
|
}
|
|
3962
4099
|
catch (err) {
|
|
@@ -3969,6 +4106,7 @@ function createErrorDiagnoser(context) {
|
|
|
3969
4106
|
* @returns 清理函数
|
|
3970
4107
|
*/
|
|
3971
4108
|
function handleFileNode(node) {
|
|
4109
|
+
// TODO: checkNodeIsFileModuleInIde 也慢,后续可以优化
|
|
3972
4110
|
const isFileModule = fileNodes.length ? (0, service_1.checkNodeIsFileModuleInIde)(node) : true;
|
|
3973
4111
|
if (isFileModule) {
|
|
3974
4112
|
fileNodes.push(node);
|
|
@@ -3988,7 +4126,8 @@ function createErrorDiagnoser(context) {
|
|
|
3988
4126
|
* @returns
|
|
3989
4127
|
*/
|
|
3990
4128
|
function* checkNode(node) {
|
|
3991
|
-
|
|
4129
|
+
// fast weak basenode check
|
|
4130
|
+
if (!node || !node.concept) {
|
|
3992
4131
|
return;
|
|
3993
4132
|
}
|
|
3994
4133
|
const cleanup = handleFileNode(node);
|
|
@@ -4062,7 +4201,7 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4062
4201
|
const records = [];
|
|
4063
4202
|
let filePath;
|
|
4064
4203
|
try {
|
|
4065
|
-
filePath = fileNode.getEmbeddedFilePath();
|
|
4204
|
+
filePath = fileNode.concept !== 'App' ? fileNode.getEmbeddedFilePath() : undefined;
|
|
4066
4205
|
}
|
|
4067
4206
|
catch (err) {
|
|
4068
4207
|
console.log(err);
|
|
@@ -4096,4 +4235,6 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
|
|
|
4096
4235
|
return records;
|
|
4097
4236
|
};
|
|
4098
4237
|
exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
|
|
4238
|
+
// @ts-expect-error
|
|
4239
|
+
const toRaw = (nd) => nd.__v_raw ?? nd;
|
|
4099
4240
|
//# sourceMappingURL=checker.js.map
|