@lcap/nasl-language-server-core 4.4.0-beta.26 → 4.4.0-beta.28
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 +65 -106
- package/out/checker.js.map +1 -1
- package/out/typer/dispatch-expr.js +1 -1
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +4 -3
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +27 -11
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +1 -0
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +2 -0
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +20 -0
- package/out/typer/unifier.js.map +1 -1
- package/package.json +5 -5
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,E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C;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
|
@@ -257,7 +257,7 @@ function createErrorDiagnoser(context) {
|
|
|
257
257
|
let env = context.env;
|
|
258
258
|
let isDebug = context.debug;
|
|
259
259
|
// 严格模式
|
|
260
|
-
let
|
|
260
|
+
let isAIStrictMode = context.isAIStrictMode;
|
|
261
261
|
// 引用管理器
|
|
262
262
|
let referenceManager = env.refMgr;
|
|
263
263
|
// 检查共享数据是否有更新
|
|
@@ -270,6 +270,8 @@ function createErrorDiagnoser(context) {
|
|
|
270
270
|
let inModule = false;
|
|
271
271
|
let inPlayground = 0;
|
|
272
272
|
let inAuthLogic = false;
|
|
273
|
+
let inFrontendType = false;
|
|
274
|
+
let currentFrontendKind = '';
|
|
273
275
|
let dbType = '';
|
|
274
276
|
let curVarCounter = 0;
|
|
275
277
|
const listComponentStack = [];
|
|
@@ -897,7 +899,7 @@ function createErrorDiagnoser(context) {
|
|
|
897
899
|
continue;
|
|
898
900
|
}
|
|
899
901
|
// 严格模式非必填也需要有Argument占位
|
|
900
|
-
if (
|
|
902
|
+
if (isAIStrictMode || !isNonRequiredParam(param)) {
|
|
901
903
|
minArgsCount++; // 如果参数有默认值,则跳过
|
|
902
904
|
}
|
|
903
905
|
}
|
|
@@ -1016,7 +1018,7 @@ function createErrorDiagnoser(context) {
|
|
|
1016
1018
|
}
|
|
1017
1019
|
else if (argsLen < minArgsCount) {
|
|
1018
1020
|
let msg = `传入参数的个数 ${argsLen} 与 ${getExpressionNodeName(node.concept)} 定义的参数个数 ${paramsLen} 不符。`;
|
|
1019
|
-
if (
|
|
1021
|
+
if (isAIStrictMode) {
|
|
1020
1022
|
msg += `可选参数和默认值参数必须用 undefined 占位`;
|
|
1021
1023
|
}
|
|
1022
1024
|
error(node, msg);
|
|
@@ -1775,7 +1777,7 @@ function createErrorDiagnoser(context) {
|
|
|
1775
1777
|
const decimalPlaces = value?.split('.')[1]?.length || 0;
|
|
1776
1778
|
if (decimalPlaces > +scale) {
|
|
1777
1779
|
error(node, `实体字段${node.name}默认值的小数位数不能大于设置的小数位数${scale},否则将会按照小数位数自动截断`, {
|
|
1778
|
-
severity:
|
|
1780
|
+
severity: isAIStrictMode ? Severity.ERROR : Severity.WARN,
|
|
1779
1781
|
});
|
|
1780
1782
|
}
|
|
1781
1783
|
}
|
|
@@ -3359,7 +3361,7 @@ function createErrorDiagnoser(context) {
|
|
|
3359
3361
|
return;
|
|
3360
3362
|
}
|
|
3361
3363
|
yield* checkVoidCallUsedAsStatement(node);
|
|
3362
|
-
const ref = env.resolveRef(node); // 前端
|
|
3364
|
+
const ref = env.resolveRef(node) ?? env.quickGetLibDef(node, node.calleeName, undefined); // 前端
|
|
3363
3365
|
// TODO: sql 函数的 namespace 带有数据库名 nasl.sqlFunction.mysql nasl.sqlFunction.oracle ...
|
|
3364
3366
|
// 暂时不在 gQNameDefs 里,用 isBuiltInCall 简单判断了
|
|
3365
3367
|
if (!ref && !isBuiltInCall(node)) {
|
|
@@ -3520,6 +3522,29 @@ function createErrorDiagnoser(context) {
|
|
|
3520
3522
|
error(node, '下载组件必须为page和size指定入参,且不能重复');
|
|
3521
3523
|
}
|
|
3522
3524
|
}
|
|
3525
|
+
const map = {
|
|
3526
|
+
frontend: {
|
|
3527
|
+
scope: '前端',
|
|
3528
|
+
forbiddenScope: '服务端',
|
|
3529
|
+
forbiddenCalleeNamesMap: {
|
|
3530
|
+
'nasl.auth': ['getCurrentUser', 'generateUserId', 'validatePassword', 'encryptPassword'],
|
|
3531
|
+
},
|
|
3532
|
+
},
|
|
3533
|
+
backend: {
|
|
3534
|
+
scope: '服务端',
|
|
3535
|
+
forbiddenScope: '前端',
|
|
3536
|
+
forbiddenCalleeNamespaces: ['nasl.browser', 'nasl.io'],
|
|
3537
|
+
forbiddenCalleeNamesMap: {
|
|
3538
|
+
'nasl.auth': ['decryptByAES', 'encryptByAES', 'logout', 'hasAuth'],
|
|
3539
|
+
'nasl.configuration': ['getCurrentIp', 'getUserLanguage', 'getI18nList', 'setI18nLocale'],
|
|
3540
|
+
},
|
|
3541
|
+
},
|
|
3542
|
+
};
|
|
3543
|
+
const config = inFrontendType ? map.frontend : map.backend;
|
|
3544
|
+
const { scope, forbiddenScope, forbiddenCalleeNamespaces, forbiddenCalleeNamesMap } = config;
|
|
3545
|
+
if (forbiddenCalleeNamespaces?.includes(node.calleeNamespace) || forbiddenCalleeNamesMap?.[node.calleeNamespace]?.includes(node.calleeName)) {
|
|
3546
|
+
error(node, `不能在${scope}作用域下使用${forbiddenScope}系统逻辑`);
|
|
3547
|
+
}
|
|
3523
3548
|
return env.getType(node);
|
|
3524
3549
|
}
|
|
3525
3550
|
/**
|
|
@@ -3979,6 +4004,36 @@ function createErrorDiagnoser(context) {
|
|
|
3979
4004
|
scopedError(node, `${node.toNaturalTS()} 枚举类不能直接使用,请取它的枚举项`);
|
|
3980
4005
|
return errorType;
|
|
3981
4006
|
}
|
|
4007
|
+
const map = {
|
|
4008
|
+
frontend: {
|
|
4009
|
+
scope: '前端',
|
|
4010
|
+
forbiddenScope: '服务端',
|
|
4011
|
+
prefix: 'app.frontendTypes',
|
|
4012
|
+
forbiddenPrefix: 'app.backend',
|
|
4013
|
+
},
|
|
4014
|
+
backend: {
|
|
4015
|
+
scope: '服务端',
|
|
4016
|
+
forbiddenScope: '前端',
|
|
4017
|
+
prefix: 'app.backend',
|
|
4018
|
+
forbiddenPrefix: 'app.frontendTypes',
|
|
4019
|
+
forbiddenCalleeNamesMap: {
|
|
4020
|
+
'nasl.auth': ['userInfo']
|
|
4021
|
+
}
|
|
4022
|
+
},
|
|
4023
|
+
};
|
|
4024
|
+
const config = inFrontendType ? map.frontend : map.backend;
|
|
4025
|
+
const { scope, forbiddenScope, prefix, forbiddenPrefix, forbiddenCalleeNamesMap } = config;
|
|
4026
|
+
// 互斥的端类型 (pc <-> h5)
|
|
4027
|
+
const forbiddenKind = currentFrontendKind === 'pc' ? 'h5' : 'pc';
|
|
4028
|
+
if (node.namespace?.startsWith(forbiddenPrefix)) {
|
|
4029
|
+
error(node, `不能在${scope}作用域下使用${forbiddenScope}全局变量`);
|
|
4030
|
+
}
|
|
4031
|
+
else if (inFrontendType && node.namespace?.startsWith(`${prefix}.${forbiddenKind}`)) {
|
|
4032
|
+
error(node, `不能在${currentFrontendKind}作用域下使用${forbiddenKind}作用域下的前端变量`);
|
|
4033
|
+
}
|
|
4034
|
+
if (forbiddenCalleeNamesMap?.[node.namespace]?.includes(node.name)) {
|
|
4035
|
+
error(node, '不能在服务端作用域下使用前端公共变量');
|
|
4036
|
+
}
|
|
3982
4037
|
// 检查使用范围
|
|
3983
4038
|
yield* checkScopeOfUse(node, ref);
|
|
3984
4039
|
return env.getType(node);
|
|
@@ -4258,97 +4313,6 @@ function createErrorDiagnoser(context) {
|
|
|
4258
4313
|
}
|
|
4259
4314
|
return env.getType(node);
|
|
4260
4315
|
}
|
|
4261
|
-
/**
|
|
4262
|
-
* 递归检查赋值类型不兼容问题
|
|
4263
|
-
* 检查左侧类型(Decimal/Long)是否与右侧联合类型(Union<Decimal, Long>)不兼容
|
|
4264
|
-
* @param leftType 左侧类型
|
|
4265
|
-
* @param rightType 右侧类型
|
|
4266
|
-
* @param context 上下文信息,用于生成错误消息
|
|
4267
|
-
* @param allowImplicitConversion 是否允许隐式类型转换(仅对直接的基础类型赋值允许,复杂类型内部不允许)
|
|
4268
|
-
* @returns 所有类型不兼容的错误信息数组
|
|
4269
|
-
*/
|
|
4270
|
-
function checkAssignmentTypeIncompatibility(leftType, rightType, context = {}, allowImplicitConversion = true) {
|
|
4271
|
-
if (!leftType || !rightType)
|
|
4272
|
-
return [];
|
|
4273
|
-
const errors = [];
|
|
4274
|
-
// 先检查 Decimal/Long vs Union<Decimal, Long> 的情况(需要先于其他检查)
|
|
4275
|
-
// 这种情况应该报错,即使允许隐式转换
|
|
4276
|
-
if (allowImplicitConversion) {
|
|
4277
|
-
const isLeftPrimitive = leftType.typeKind === 'primitive';
|
|
4278
|
-
const isLeftDecimalOrLong = isLeftPrimitive && (leftType.typeName === 'Decimal' || leftType.typeName === 'Long');
|
|
4279
|
-
if (isLeftDecimalOrLong && (0, type_predicate_1.isDecimalUnionLongTy)(rightType)) {
|
|
4280
|
-
const prefix = context.prefix || '赋值';
|
|
4281
|
-
const fieldInfo = context.fieldName ? `字段 ${context.fieldName} ` : '';
|
|
4282
|
-
errors.push(`${prefix}:${fieldInfo}类型不匹配,不能将 ${(0, type_manager_1.showUserLevelType)(rightType)} 赋值给 ${(0, type_manager_1.showUserLevelType)(leftType)} 类型。`);
|
|
4283
|
-
return errors; // 找到基本类型错误后直接返回,不再检查嵌套
|
|
4284
|
-
}
|
|
4285
|
-
}
|
|
4286
|
-
// 检查基础类型是否严格相等(不允许隐式转换)
|
|
4287
|
-
const isLeftPrimitive = leftType.typeKind === 'primitive';
|
|
4288
|
-
const isRightPrimitive = rightType.typeKind === 'primitive';
|
|
4289
|
-
if (isLeftPrimitive && isRightPrimitive) {
|
|
4290
|
-
// 如果不允许隐式转换,则要求类型完全相等
|
|
4291
|
-
if (!allowImplicitConversion) {
|
|
4292
|
-
if (leftType.typeName !== rightType.typeName || leftType.typeNamespace !== rightType.typeNamespace) {
|
|
4293
|
-
const prefix = context.prefix || '赋值';
|
|
4294
|
-
const fieldInfo = context.fieldName ? `字段 ${context.fieldName} ` : '';
|
|
4295
|
-
errors.push(`${prefix}:${fieldInfo}类型不匹配,不能将 ${(0, type_manager_1.showUserLevelType)(rightType)} 赋值给 ${(0, type_manager_1.showUserLevelType)(leftType)} 类型。`);
|
|
4296
|
-
return errors;
|
|
4297
|
-
}
|
|
4298
|
-
// 类型完全相等,没有错误,继续检查其他情况
|
|
4299
|
-
}
|
|
4300
|
-
else {
|
|
4301
|
-
// 允许隐式转换的情况下,检查是否通过 isSubTy 检查(允许隐式转换)
|
|
4302
|
-
if ((0, type_predicate_1.isSubTy)(env, rightType, leftType)) {
|
|
4303
|
-
// 类型兼容(允许隐式转换),没有错误,继续检查其他情况
|
|
4304
|
-
}
|
|
4305
|
-
// 如果 isSubTy 返回 false,继续检查其他不兼容的情况
|
|
4306
|
-
}
|
|
4307
|
-
}
|
|
4308
|
-
// 2. 检查 List 类型(包括嵌套):List<T> vs List<Union<...>>
|
|
4309
|
-
if (leftType.typeKind === 'generic' &&
|
|
4310
|
-
leftType.typeName === 'List' &&
|
|
4311
|
-
rightType.typeKind === 'generic' &&
|
|
4312
|
-
rightType.typeName === 'List' &&
|
|
4313
|
-
leftType.typeArguments?.[0] &&
|
|
4314
|
-
rightType.typeArguments?.[0]) {
|
|
4315
|
-
// 递归检查 List 的元素类型,嵌套类型内部不允许隐式转换
|
|
4316
|
-
return checkAssignmentTypeIncompatibility(leftType.typeArguments[0], rightType.typeArguments[0], { ...context, prefix: context.prefix || '赋值' }, false // 嵌套类型内部不允许隐式转换
|
|
4317
|
-
);
|
|
4318
|
-
}
|
|
4319
|
-
// 3. 检查 Map 类型(包括嵌套):Map<K, V> vs Map<K, Union<...>>
|
|
4320
|
-
if (leftType.typeKind === 'generic' &&
|
|
4321
|
-
leftType.typeName === 'Map' &&
|
|
4322
|
-
rightType.typeKind === 'generic' &&
|
|
4323
|
-
rightType.typeName === 'Map' &&
|
|
4324
|
-
leftType.typeArguments?.length === 2 &&
|
|
4325
|
-
rightType.typeArguments?.length === 2) {
|
|
4326
|
-
// 递归检查 Map 的值类型(第二个类型参数),嵌套类型内部不允许隐式转换
|
|
4327
|
-
const valueTypeErrors = checkAssignmentTypeIncompatibility(leftType.typeArguments[1], rightType.typeArguments[1], { ...context, prefix: context.prefix || '赋值' }, false // 嵌套类型内部不允许隐式转换
|
|
4328
|
-
);
|
|
4329
|
-
errors.push(...valueTypeErrors);
|
|
4330
|
-
// 也检查键类型(第一个类型参数),嵌套类型内部不允许隐式转换
|
|
4331
|
-
const keyTypeErrors = checkAssignmentTypeIncompatibility(leftType.typeArguments[0], rightType.typeArguments[0], { ...context, prefix: context.prefix || '赋值' }, false // 嵌套类型内部不允许隐式转换
|
|
4332
|
-
);
|
|
4333
|
-
errors.push(...keyTypeErrors);
|
|
4334
|
-
return errors;
|
|
4335
|
-
}
|
|
4336
|
-
// 4. 检查匿名结构体:递归检查每个字段,收集所有字段的错误
|
|
4337
|
-
if ((0, type_predicate_1.isAnonymousTy)(leftType) && (0, type_predicate_1.isAnonymousTy)(rightType)) {
|
|
4338
|
-
const leftProps = leftType.properties ?? [];
|
|
4339
|
-
const rightProps = rightType.properties ?? [];
|
|
4340
|
-
for (const leftProp of leftProps) {
|
|
4341
|
-
const rightProp = rightProps.find(p => p.name === leftProp.name);
|
|
4342
|
-
if (rightProp && leftProp.typeAnnotation && rightProp.typeAnnotation) {
|
|
4343
|
-
// 匿名结构体的字段类型检查不允许隐式转换
|
|
4344
|
-
const fieldErrors = checkAssignmentTypeIncompatibility(leftProp.typeAnnotation, rightProp.typeAnnotation, { prefix: context.prefix || '赋值', fieldName: leftProp.name }, false // 复杂类型内部不允许隐式转换
|
|
4345
|
-
);
|
|
4346
|
-
errors.push(...fieldErrors); // 收集所有字段的错误,不提前返回
|
|
4347
|
-
}
|
|
4348
|
-
}
|
|
4349
|
-
}
|
|
4350
|
-
return errors;
|
|
4351
|
-
}
|
|
4352
4316
|
/**
|
|
4353
4317
|
* 检查 赋值语句
|
|
4354
4318
|
* @param node
|
|
@@ -4360,14 +4324,6 @@ function createErrorDiagnoser(context) {
|
|
|
4360
4324
|
if (ensureNodeKeyExists(node, 'right')) {
|
|
4361
4325
|
yield* checkNode(node.right);
|
|
4362
4326
|
}
|
|
4363
|
-
// 使用统一的类型兼容性检查
|
|
4364
|
-
const leftType = env.getType(node.left);
|
|
4365
|
-
const rightType = env.getType(node.right);
|
|
4366
|
-
const errorMessages = checkAssignmentTypeIncompatibility(leftType, rightType);
|
|
4367
|
-
// 报告所有错误
|
|
4368
|
-
errorMessages.forEach(errorMessage => {
|
|
4369
|
-
error(node, errorMessage);
|
|
4370
|
-
});
|
|
4371
4327
|
if (nasl_concepts_1.asserts.isMemberExpression(node.left)) {
|
|
4372
4328
|
reportCurrentItemModification(node.left, node);
|
|
4373
4329
|
}
|
|
@@ -4433,7 +4389,7 @@ function createErrorDiagnoser(context) {
|
|
|
4433
4389
|
error(args[i], '当前参数无效,不可用。');
|
|
4434
4390
|
}
|
|
4435
4391
|
}
|
|
4436
|
-
if (
|
|
4392
|
+
if (isAIStrictMode) {
|
|
4437
4393
|
yield* checkCallExpressionParameters(node, ref);
|
|
4438
4394
|
}
|
|
4439
4395
|
}
|
|
@@ -5273,6 +5229,9 @@ function createErrorDiagnoser(context) {
|
|
|
5273
5229
|
inModule = !!node.getAncestor?.('Module');
|
|
5274
5230
|
inPlayground = 0;
|
|
5275
5231
|
inAuthLogic = false;
|
|
5232
|
+
const frontendType = node.getAncestor?.('FrontendType');
|
|
5233
|
+
inFrontendType = !!frontendType;
|
|
5234
|
+
currentFrontendKind = frontendType?.kind || '';
|
|
5276
5235
|
fileNodes.push(node);
|
|
5277
5236
|
let diagnostics = diagnosticMap.get(node);
|
|
5278
5237
|
if (!diagnostics) {
|
|
@@ -5596,7 +5555,7 @@ exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
|
|
|
5596
5555
|
// @ts-expect-error
|
|
5597
5556
|
const toRaw = (nd) => nd.__v_raw ?? nd;
|
|
5598
5557
|
// 是否来自系统内置
|
|
5599
|
-
const isBuiltInCall = (nd) => !!nd.calleeNamespace?.startsWith('nasl.');
|
|
5558
|
+
const isBuiltInCall = (nd) => !!nd.calleeNamespace?.startsWith('nasl.') && !['nasl.auth'].includes(nd.calleeNamespace);
|
|
5600
5559
|
// 获取依赖库名
|
|
5601
5560
|
const getExtensionLibName = (nd) => nd.calleeNamespace?.startsWith('extensions.') ? nd.calleeNamespace.split('.')[1] : undefined;
|
|
5602
5561
|
//# sourceMappingURL=checker.js.map
|