@lcap/nasl-language-server-core 4.5.0-beta.1 → 4.5.0-beta.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.map +1 -1
- package/out/checker.js +26 -4
- 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/dispatch-call.d.ts.map +1 -1
- package/out/typer/dispatch-call.js +14 -1
- 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 +14 -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/subster.d.ts.map +1 -1
- package/out/typer/subster.js +47 -10
- package/out/typer/subster.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 +2 -2
- package/out/utils/parseTsClassType.js.map +1 -1
- package/package.json +6 -6
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,M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BACN,MAAM;qBACH,MAAM;;kBAlqKF,UAAU,WAAW,MAAM,YAAY,YAAY;sCAg5D/B,IAAI,GAAG,QAAQ;2CAqzGxC,UAAU,gBACV,CAAC,YAAY,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,gBAC/C,CAAC,GAAG,EAAE,UAAU,KAAK,OAAO,qBACvB,MAAM,EAAE,oBACT,CAAC,YAAY,EAAE,UAAU,KAAK,UAAU,EAAE,KAC3D,kBAAkB,GAAG,IAAI;EAwF7B;AAqED,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
|
@@ -285,6 +285,7 @@ function createErrorDiagnoser(context) {
|
|
|
285
285
|
Param: 'getVarExistingNames',
|
|
286
286
|
Return: 'getVarExistingNames',
|
|
287
287
|
Variable: 'getVarExistingNames',
|
|
288
|
+
Identifier: 'getPropertyExistingNames',
|
|
288
289
|
Enum: 'getEnumExistingNames',
|
|
289
290
|
EnumItem: 'getEnumItemExistingNames',
|
|
290
291
|
EnumItemInteger: 'getEnumItemExistingNames',
|
|
@@ -499,7 +500,8 @@ function createErrorDiagnoser(context) {
|
|
|
499
500
|
conceptValidator = nasl_concepts_1.staticRules['EnumItemInteger'];
|
|
500
501
|
validatorMapKey = 'EnumItemInteger';
|
|
501
502
|
}
|
|
502
|
-
else if (concept === 'StructureProperty' && node
|
|
503
|
+
else if ((concept === 'StructureProperty' && node.parentNode?.concept !== 'Structure')
|
|
504
|
+
|| (concept === 'Identifier' && node.parentNode?.concept === 'NewComposite')) {
|
|
503
505
|
conceptValidator = nasl_concepts_1.staticRules['TypeStructureProperty'];
|
|
504
506
|
validatorMapKey = 'TypeStructureProperty';
|
|
505
507
|
}
|
|
@@ -3536,10 +3538,11 @@ function createErrorDiagnoser(context) {
|
|
|
3536
3538
|
backend: {
|
|
3537
3539
|
scope: '服务端',
|
|
3538
3540
|
forbiddenScope: '前端',
|
|
3539
|
-
forbiddenCalleeNamespaces: ['nasl.browser', 'nasl.io'],
|
|
3541
|
+
forbiddenCalleeNamespaces: ['nasl.browser', 'nasl.io', 'nasl.ui'],
|
|
3540
3542
|
forbiddenCalleeNamesMap: {
|
|
3541
3543
|
'nasl.auth': ['decryptByAES', 'encryptByAES', 'logout', 'hasAuth'],
|
|
3542
3544
|
'nasl.configuration': ['getCurrentIp', 'getUserLanguage', 'getI18nList', 'setI18nLocale'],
|
|
3545
|
+
'nasl.ui': ['showMessage'],
|
|
3543
3546
|
},
|
|
3544
3547
|
},
|
|
3545
3548
|
};
|
|
@@ -4150,6 +4153,9 @@ function createErrorDiagnoser(context) {
|
|
|
4150
4153
|
*/
|
|
4151
4154
|
function* checkNewList(node) {
|
|
4152
4155
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4156
|
+
if (node.typeAnnotation) {
|
|
4157
|
+
yield* checkNode(node.typeAnnotation);
|
|
4158
|
+
}
|
|
4153
4159
|
// 匿名函数返回值有可能是newList,需要过滤。代码来源:AnonymousFunction.__ts
|
|
4154
4160
|
const grandParent = node.parentNode?.parentNode?.parentNode;
|
|
4155
4161
|
if (isEntityUpdate(grandParent)) {
|
|
@@ -4187,6 +4193,9 @@ function createErrorDiagnoser(context) {
|
|
|
4187
4193
|
*/
|
|
4188
4194
|
function* checkNewMap(node) {
|
|
4189
4195
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4196
|
+
if (node.typeAnnotation) {
|
|
4197
|
+
yield* checkNode(node.typeAnnotation);
|
|
4198
|
+
}
|
|
4190
4199
|
if (node.keys?.length) {
|
|
4191
4200
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.keys, function* (node) {
|
|
4192
4201
|
yield* checkNode(node);
|
|
@@ -4225,6 +4234,9 @@ function createErrorDiagnoser(context) {
|
|
|
4225
4234
|
*/
|
|
4226
4235
|
function* checkNewComposite(node) {
|
|
4227
4236
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4237
|
+
if (node.typeAnnotation) {
|
|
4238
|
+
yield* checkNode(node.typeAnnotation);
|
|
4239
|
+
}
|
|
4228
4240
|
ensureNodeKeyExists(node, 'typeAnnotation');
|
|
4229
4241
|
const type = env.getType(node);
|
|
4230
4242
|
if (node.properties?.length) {
|
|
@@ -4527,8 +4539,18 @@ function createErrorDiagnoser(context) {
|
|
|
4527
4539
|
const type = env.getType(variable);
|
|
4528
4540
|
// 如果是复杂数据结构
|
|
4529
4541
|
if (type?.isComplexType()) {
|
|
4530
|
-
if (type?.typeName === 'List'
|
|
4531
|
-
|
|
4542
|
+
if (type?.typeName === 'List') {
|
|
4543
|
+
const typeArgument = type?.typeArguments?.[0];
|
|
4544
|
+
if (typeArgument?.typeKind === 'primitive') {
|
|
4545
|
+
return;
|
|
4546
|
+
}
|
|
4547
|
+
const { parentKey, parentNode } = variable;
|
|
4548
|
+
if (parentKey === 'right' && parentNode?.concept === 'BinaryExpression' && parentNode?.operator === 'in') {
|
|
4549
|
+
const ref = env.resolveRef(typeArgument);
|
|
4550
|
+
if (ref?.concept === 'Enum') {
|
|
4551
|
+
return;
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4532
4554
|
}
|
|
4533
4555
|
error(node, `数据查询中不可以使用复杂类型!当前类型:${type?.typeChineseTitle}。`, {
|
|
4534
4556
|
severity: Severity.WARN,
|