@lcap/nasl-language-server-core 4.0.1-rc.1 → 4.0.1-rc.2
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 +24 -3
- package/out/checker.js.map +1 -1
- package/out/index.d.ts +2 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +4 -1
- package/out/index.js.map +1 -1
- package/out/reference-manager/builtin-q-name.d.ts +1 -1
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +14 -10
- 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 +29 -28
- package/out/reference-manager/collect-q-name.js.map +1 -1
- package/out/reference-manager/get-q-name.d.ts +0 -2
- package/out/reference-manager/get-q-name.d.ts.map +1 -1
- package/out/reference-manager/get-q-name.js +56 -57
- package/out/reference-manager/get-q-name.js.map +1 -1
- package/out/reference-manager/reference-manager.d.ts +21 -11
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +192 -101
- 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 +33 -29
- 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 +13 -3
- package/out/reference-manager/rename-q-name.js.map +1 -1
- package/out/reference-manager/symbol-type.d.ts +5 -3
- package/out/reference-manager/symbol-type.d.ts.map +1 -1
- package/out/reference-manager/symbol-type.js +8 -3
- package/out/reference-manager/symbol-type.js.map +1 -1
- package/out/reference-manager/update-nasl-fragment.d.ts.map +1 -1
- package/out/reference-manager/update-nasl-fragment.js +4 -4
- package/out/reference-manager/update-nasl-fragment.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts +1 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +2 -2
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +2 -2
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/dispatch-all.d.ts +1 -1
- package/out/typer/dispatch-all.d.ts.map +1 -1
- package/out/typer/dispatch-all.js +2 -2
- package/out/typer/dispatch-all.js.map +1 -1
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +3 -0
- package/out/typer/dispatch-def.js.map +1 -1
- package/out/typer/dispatch-expr.d.ts.map +1 -1
- package/out/typer/dispatch-expr.js +135 -100
- 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 +17 -5
- package/out/typer/dispatch-process.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 +15 -11
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +28 -44
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +2 -1
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +3 -1
- package/out/typer/index.js.map +1 -1
- package/out/typer/nasl-predicate.d.ts +1 -2
- package/out/typer/nasl-predicate.d.ts.map +1 -1
- package/out/typer/overload-helper.d.ts +12 -0
- package/out/typer/overload-helper.d.ts.map +1 -0
- package/out/typer/overload-helper.js +110 -0
- package/out/typer/overload-helper.js.map +1 -0
- package/out/typer/sem-diag.d.ts +4 -0
- package/out/typer/sem-diag.d.ts.map +1 -1
- package/out/typer/sem-diag.js +9 -1
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts +2 -2
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +17 -19
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +10 -5
- package/out/typer/subster.js.map +1 -1
- package/out/typer/type-hint-manager/type-hint-manager.d.ts +1 -1
- package/out/typer/type-hint-manager/type-hint-manager.d.ts.map +1 -1
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +3 -3
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.js +5 -5
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +7 -4
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +24 -17
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +10 -4
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/parseTsClassType.d.ts +2 -3
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +25 -58
- package/out/utils/parseTsClassType.js.map +1 -1
- package/out/utils/string.d.ts +4 -0
- package/out/utils/string.d.ts.map +1 -0
- package/out/utils/string.js +29 -0
- package/out/utils/string.js.map +1 -0
- package/out/utils/type-operator.d.ts +1 -1
- package/out/utils/type-operator.d.ts.map +1 -1
- package/out/utils/type-operator.js +12 -12
- package/out/utils/type-operator.js.map +1 -1
- package/package.json +9 -6
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",
|
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;AAMpE,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;oCAunIpB,OAAO;sDAPW,gBAAgB,EAAE;;;;sBAhBjD,UAAU,GAAG,SAAS;;;8BA4Df,UAAU;2BAuBb,UAAU;;kBA3nInB,UAAU,WAAW,MAAM,YAAY,YAAY;EA6oIzE;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;AAMD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/out/checker.js
CHANGED
|
@@ -6,10 +6,11 @@ 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
12
|
const nasl_predicate_1 = require("./typer/nasl-predicate");
|
|
13
|
+
const helper_1 = require("./typer/helper");
|
|
13
14
|
var Severity;
|
|
14
15
|
(function (Severity) {
|
|
15
16
|
Severity["WARN"] = "warning";
|
|
@@ -333,7 +334,7 @@ function createErrorDiagnoser(context) {
|
|
|
333
334
|
currentNode = currentNode.parentNode;
|
|
334
335
|
}
|
|
335
336
|
const finalNode = memberExpression ?? node;
|
|
336
|
-
(0,
|
|
337
|
+
(0, helper_1.createOnPush)(diagnostics, finalNode, diagnostic);
|
|
337
338
|
finalNode.tsErrorDetail = diagnostic;
|
|
338
339
|
}
|
|
339
340
|
else { }
|
|
@@ -2816,6 +2817,9 @@ function createErrorDiagnoser(context) {
|
|
|
2816
2817
|
if (node.calleeName === 'Clear' && type?.typeKind === 'union') {
|
|
2817
2818
|
error(node, `传入类型错误,接收类型:非union类型`);
|
|
2818
2819
|
}
|
|
2820
|
+
if (node.calleeName === 'ListSort' || node.calleeName === 'ListSortAsync') {
|
|
2821
|
+
checkListSort(node);
|
|
2822
|
+
}
|
|
2819
2823
|
if (node.typeArguments?.length) {
|
|
2820
2824
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.typeArguments, function* (node) {
|
|
2821
2825
|
yield* checkNode(node);
|
|
@@ -2859,6 +2863,23 @@ function createErrorDiagnoser(context) {
|
|
|
2859
2863
|
}
|
|
2860
2864
|
}
|
|
2861
2865
|
return type;
|
|
2866
|
+
function checkListSort(nd) {
|
|
2867
|
+
for (let i = 1; i < nd.arguments.length; i++) {
|
|
2868
|
+
const expr = nd.arguments[i].expression;
|
|
2869
|
+
let resTy;
|
|
2870
|
+
if (expr?.concept === 'AnonymousFunction') {
|
|
2871
|
+
resTy = env.getType(expr.body);
|
|
2872
|
+
}
|
|
2873
|
+
else if (expr?.concept === 'SubLogic') {
|
|
2874
|
+
resTy = env.getType(expr.returns?.[0]);
|
|
2875
|
+
}
|
|
2876
|
+
const byTy = resTy?.properties?.find((prop) => prop.name === 'by')?.typeAnnotation;
|
|
2877
|
+
if (byTy?.typeKind === 'union') {
|
|
2878
|
+
// 这里使用 node.arguments[i] 则无红框,猜测是 ListSort 的特殊交互导致的问题
|
|
2879
|
+
error(node, (0, sem_diag_1.mkIncompatibleTyErr)(env, byTy, '非 union 的基础类型:如字符串、整数、布尔等'));
|
|
2880
|
+
}
|
|
2881
|
+
}
|
|
2882
|
+
}
|
|
2862
2883
|
}
|
|
2863
2884
|
/**
|
|
2864
2885
|
* 检查 调用逻辑
|
|
@@ -3277,7 +3298,7 @@ function createErrorDiagnoser(context) {
|
|
|
3277
3298
|
/**
|
|
3278
3299
|
* 参考类型检查器的 {@link tpIdentifier}方法
|
|
3279
3300
|
*/
|
|
3280
|
-
return
|
|
3301
|
+
return type_manager_1.naslLongTy;
|
|
3281
3302
|
}
|
|
3282
3303
|
else if (node.name === 'it') {
|
|
3283
3304
|
return env.getType(node);
|