@lcap/nasl-language-server-core 4.5.0-beta.1 → 4.5.0-beta.3
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.map +1 -1
- package/out/checker.js +29 -5
- package/out/checker.js.map +1 -1
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +14 -0
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +18 -0
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/dispatch-call.d.ts.map +1 -1
- package/out/typer/dispatch-call.js +20 -2
- package/out/typer/dispatch-call.js.map +1 -1
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +1 -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 +2 -1
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +21 -4
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/overload-helper.d.ts +1 -1
- package/out/typer/overload-helper.d.ts.map +1 -1
- package/out/typer/overload-helper.js +10 -2
- package/out/typer/overload-helper.js.map +1 -1
- package/out/typer/sem-diag.js +1 -1
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +2 -2
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +47 -10
- package/out/typer/subster.js.map +1 -1
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +4 -0
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.d.ts +5 -0
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +24 -17
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +8 -0
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +8 -0
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts +24 -0
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +54 -2
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/file-node-cache.d.ts.map +1 -1
- package/out/utils/file-node-cache.js +5 -4
- package/out/utils/file-node-cache.js.map +1 -1
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +8 -2
- package/out/utils/parseTsClassType.js.map +1 -1
- package/package.json +7 -7
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,EAC4C,QAAQ,EAC5B,IAAI,EAQ+E,GAAG,EAMxH,QAAQ,EAGT,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;AAYpE,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;AAOF,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AAEpE,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,UAAU,EAAE,kBAAk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,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
|
@@ -271,6 +271,7 @@ function createErrorDiagnoser(context) {
|
|
|
271
271
|
let inPlayground = 0;
|
|
272
272
|
let inAuthLogic = false;
|
|
273
273
|
let inFrontendType = false;
|
|
274
|
+
let currentFrameworkKind = 'vue2';
|
|
274
275
|
let currentFrontendKind = '';
|
|
275
276
|
let dbType = '';
|
|
276
277
|
let curVarCounter = 0;
|
|
@@ -285,6 +286,7 @@ function createErrorDiagnoser(context) {
|
|
|
285
286
|
Param: 'getVarExistingNames',
|
|
286
287
|
Return: 'getVarExistingNames',
|
|
287
288
|
Variable: 'getVarExistingNames',
|
|
289
|
+
Identifier: 'getPropertyExistingNames',
|
|
288
290
|
Enum: 'getEnumExistingNames',
|
|
289
291
|
EnumItem: 'getEnumItemExistingNames',
|
|
290
292
|
EnumItemInteger: 'getEnumItemExistingNames',
|
|
@@ -499,7 +501,8 @@ function createErrorDiagnoser(context) {
|
|
|
499
501
|
conceptValidator = nasl_concepts_1.staticRules['EnumItemInteger'];
|
|
500
502
|
validatorMapKey = 'EnumItemInteger';
|
|
501
503
|
}
|
|
502
|
-
else if (concept === 'StructureProperty' && node
|
|
504
|
+
else if ((concept === 'StructureProperty' && node.parentNode?.concept !== 'Structure')
|
|
505
|
+
|| (concept === 'Identifier' && node.parentNode?.concept === 'NewComposite')) {
|
|
503
506
|
conceptValidator = nasl_concepts_1.staticRules['TypeStructureProperty'];
|
|
504
507
|
validatorMapKey = 'TypeStructureProperty';
|
|
505
508
|
}
|
|
@@ -776,7 +779,7 @@ function createErrorDiagnoser(context) {
|
|
|
776
779
|
if (!info)
|
|
777
780
|
return;
|
|
778
781
|
const { ctx, afterItemPath, currentName } = info;
|
|
779
|
-
if (!afterItemPath)
|
|
782
|
+
if (!afterItemPath || currentFrameworkKind !== 'vue3')
|
|
780
783
|
return;
|
|
781
784
|
error(errorNode, `组件列表 ${ctx.node.name || ctx.node.tag} 内部存在对数据源数据 ${currentName}.item.${afterItemPath} 的修改,请切换成表单模式,并且需要将“数据源”属性切换为使用“表单数据”属性`);
|
|
782
785
|
}
|
|
@@ -3536,10 +3539,11 @@ function createErrorDiagnoser(context) {
|
|
|
3536
3539
|
backend: {
|
|
3537
3540
|
scope: '服务端',
|
|
3538
3541
|
forbiddenScope: '前端',
|
|
3539
|
-
forbiddenCalleeNamespaces: ['nasl.browser', 'nasl.io'],
|
|
3542
|
+
forbiddenCalleeNamespaces: ['nasl.browser', 'nasl.io', 'nasl.ui'],
|
|
3540
3543
|
forbiddenCalleeNamesMap: {
|
|
3541
3544
|
'nasl.auth': ['decryptByAES', 'encryptByAES', 'logout', 'hasAuth'],
|
|
3542
3545
|
'nasl.configuration': ['getCurrentIp', 'getUserLanguage', 'getI18nList', 'setI18nLocale'],
|
|
3546
|
+
'nasl.ui': ['showMessage'],
|
|
3543
3547
|
},
|
|
3544
3548
|
},
|
|
3545
3549
|
};
|
|
@@ -4150,6 +4154,9 @@ function createErrorDiagnoser(context) {
|
|
|
4150
4154
|
*/
|
|
4151
4155
|
function* checkNewList(node) {
|
|
4152
4156
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4157
|
+
if (node.typeAnnotation) {
|
|
4158
|
+
yield* checkNode(node.typeAnnotation);
|
|
4159
|
+
}
|
|
4153
4160
|
// 匿名函数返回值有可能是newList,需要过滤。代码来源:AnonymousFunction.__ts
|
|
4154
4161
|
const grandParent = node.parentNode?.parentNode?.parentNode;
|
|
4155
4162
|
if (isEntityUpdate(grandParent)) {
|
|
@@ -4187,6 +4194,9 @@ function createErrorDiagnoser(context) {
|
|
|
4187
4194
|
*/
|
|
4188
4195
|
function* checkNewMap(node) {
|
|
4189
4196
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4197
|
+
if (node.typeAnnotation) {
|
|
4198
|
+
yield* checkNode(node.typeAnnotation);
|
|
4199
|
+
}
|
|
4190
4200
|
if (node.keys?.length) {
|
|
4191
4201
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.keys, function* (node) {
|
|
4192
4202
|
yield* checkNode(node);
|
|
@@ -4225,6 +4235,9 @@ function createErrorDiagnoser(context) {
|
|
|
4225
4235
|
*/
|
|
4226
4236
|
function* checkNewComposite(node) {
|
|
4227
4237
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4238
|
+
if (node.typeAnnotation) {
|
|
4239
|
+
yield* checkNode(node.typeAnnotation);
|
|
4240
|
+
}
|
|
4228
4241
|
ensureNodeKeyExists(node, 'typeAnnotation');
|
|
4229
4242
|
const type = env.getType(node);
|
|
4230
4243
|
if (node.properties?.length) {
|
|
@@ -4527,8 +4540,18 @@ function createErrorDiagnoser(context) {
|
|
|
4527
4540
|
const type = env.getType(variable);
|
|
4528
4541
|
// 如果是复杂数据结构
|
|
4529
4542
|
if (type?.isComplexType()) {
|
|
4530
|
-
if (type?.typeName === 'List'
|
|
4531
|
-
|
|
4543
|
+
if (type?.typeName === 'List') {
|
|
4544
|
+
const typeArgument = type?.typeArguments?.[0];
|
|
4545
|
+
if (typeArgument?.typeKind === 'primitive') {
|
|
4546
|
+
return;
|
|
4547
|
+
}
|
|
4548
|
+
const { parentKey, parentNode } = variable;
|
|
4549
|
+
if (parentKey === 'right' && parentNode?.concept === 'BinaryExpression' && parentNode?.operator === 'in') {
|
|
4550
|
+
const ref = env.resolveRef(typeArgument);
|
|
4551
|
+
if (ref?.concept === 'Enum') {
|
|
4552
|
+
return;
|
|
4553
|
+
}
|
|
4554
|
+
}
|
|
4532
4555
|
}
|
|
4533
4556
|
error(node, `数据查询中不可以使用复杂类型!当前类型:${type?.typeChineseTitle}。`, {
|
|
4534
4557
|
severity: Severity.WARN,
|
|
@@ -5234,6 +5257,7 @@ function createErrorDiagnoser(context) {
|
|
|
5234
5257
|
inAuthLogic = false;
|
|
5235
5258
|
const frontendType = node.getAncestor?.('FrontendType');
|
|
5236
5259
|
inFrontendType = !!frontendType;
|
|
5260
|
+
currentFrameworkKind = frontendType?.frameworkKind || 'vue2';
|
|
5237
5261
|
currentFrontendKind = frontendType?.kind || '';
|
|
5238
5262
|
fileNodes.push(node);
|
|
5239
5263
|
let diagnostics = diagnosticMap.get(node);
|