@lcap/nasl-language-server-core 3.14.0-beta.2 → 3.14.0-beta.4

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.
Files changed (94) hide show
  1. package/out/checker.d.ts.map +1 -1
  2. package/out/checker.js +113 -26
  3. package/out/checker.js.map +1 -1
  4. package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
  5. package/out/reference-manager/builtin-q-name.js +4 -4
  6. package/out/reference-manager/builtin-q-name.js.map +1 -1
  7. package/out/reference-manager/collect-q-name.d.ts.map +1 -1
  8. package/out/reference-manager/collect-q-name.js +4 -3
  9. package/out/reference-manager/collect-q-name.js.map +1 -1
  10. package/out/reference-manager/reference-manager.d.ts +15 -6
  11. package/out/reference-manager/reference-manager.d.ts.map +1 -1
  12. package/out/reference-manager/reference-manager.js +121 -78
  13. package/out/reference-manager/reference-manager.js.map +1 -1
  14. package/out/reference-manager/remove-q-name.d.ts.map +1 -1
  15. package/out/reference-manager/remove-q-name.js +5 -2
  16. package/out/reference-manager/remove-q-name.js.map +1 -1
  17. package/out/typer/collectGlobalDefs.js +4 -4
  18. package/out/typer/collectGlobalDefs.js.map +1 -1
  19. package/out/typer/component-def-manager/component-def-manager.d.ts +9 -4
  20. package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
  21. package/out/typer/component-def-manager/component-def-manager.js +12 -6
  22. package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
  23. package/out/typer/component-def-manager/utils.js +5 -5
  24. package/out/typer/component-def-manager/utils.js.map +1 -1
  25. package/out/typer/dispatch-all.d.ts +9 -2
  26. package/out/typer/dispatch-all.d.ts.map +1 -1
  27. package/out/typer/dispatch-all.js +35 -36
  28. package/out/typer/dispatch-all.js.map +1 -1
  29. package/out/typer/dispatch-def.d.ts +3 -3
  30. package/out/typer/dispatch-def.d.ts.map +1 -1
  31. package/out/typer/dispatch-def.js +32 -20
  32. package/out/typer/dispatch-def.js.map +1 -1
  33. package/out/typer/dispatch-expr.d.ts +2 -8
  34. package/out/typer/dispatch-expr.d.ts.map +1 -1
  35. package/out/typer/dispatch-expr.js +303 -266
  36. package/out/typer/dispatch-expr.js.map +1 -1
  37. package/out/typer/dispatch-process.d.ts +0 -2
  38. package/out/typer/dispatch-process.d.ts.map +1 -1
  39. package/out/typer/dispatch-process.js +45 -38
  40. package/out/typer/dispatch-process.js.map +1 -1
  41. package/out/typer/dispatch-stmt.d.ts.map +1 -1
  42. package/out/typer/dispatch-stmt.js +23 -29
  43. package/out/typer/dispatch-stmt.js.map +1 -1
  44. package/out/typer/dispatch-view.d.ts +13 -1
  45. package/out/typer/dispatch-view.d.ts.map +1 -1
  46. package/out/typer/dispatch-view.js +207 -71
  47. package/out/typer/dispatch-view.js.map +1 -1
  48. package/out/typer/helper.js +2 -2
  49. package/out/typer/helper.js.map +1 -1
  50. package/out/typer/incremental-update.d.ts +4 -3
  51. package/out/typer/incremental-update.d.ts.map +1 -1
  52. package/out/typer/incremental-update.js +37 -47
  53. package/out/typer/incremental-update.js.map +1 -1
  54. package/out/typer/index.d.ts +3 -3
  55. package/out/typer/index.d.ts.map +1 -1
  56. package/out/typer/index.js +14 -16
  57. package/out/typer/index.js.map +1 -1
  58. package/out/typer/sem-diag.js +1 -1
  59. package/out/typer/sem-diag.js.map +1 -1
  60. package/out/typer/solver.d.ts.map +1 -1
  61. package/out/typer/solver.js +54 -37
  62. package/out/typer/solver.js.map +1 -1
  63. package/out/typer/subster.d.ts +2 -5
  64. package/out/typer/subster.d.ts.map +1 -1
  65. package/out/typer/subster.js +95 -75
  66. package/out/typer/subster.js.map +1 -1
  67. package/out/typer/topo-sort.d.ts +3 -3
  68. package/out/typer/topo-sort.d.ts.map +1 -1
  69. package/out/typer/topo-sort.js +1 -7
  70. package/out/typer/topo-sort.js.map +1 -1
  71. package/out/typer/type-hint-manager/type-hint-manager.d.ts +36 -0
  72. package/out/typer/type-hint-manager/type-hint-manager.d.ts.map +1 -0
  73. package/out/typer/type-hint-manager/type-hint-manager.js +50 -0
  74. package/out/typer/type-hint-manager/type-hint-manager.js.map +1 -0
  75. package/out/typer/typeManager.d.ts +23 -18
  76. package/out/typer/typeManager.d.ts.map +1 -1
  77. package/out/typer/typeManager.js +141 -101
  78. package/out/typer/typeManager.js.map +1 -1
  79. package/out/typer/typer.d.ts +44 -12
  80. package/out/typer/typer.d.ts.map +1 -1
  81. package/out/typer/typer.js +69 -27
  82. package/out/typer/typer.js.map +1 -1
  83. package/out/typer/unifier.d.ts +11 -2
  84. package/out/typer/unifier.d.ts.map +1 -1
  85. package/out/typer/unifier.js +71 -30
  86. package/out/typer/unifier.js.map +1 -1
  87. package/out/utils/bind-expression-hack.d.ts +2 -1
  88. package/out/utils/bind-expression-hack.d.ts.map +1 -1
  89. package/out/utils/bind-expression-hack.js +1 -1
  90. package/out/utils/bind-expression-hack.js.map +1 -1
  91. package/out/utils/parseTsClassType.d.ts.map +1 -1
  92. package/out/utils/parseTsClassType.js +13 -15
  93. package/out/utils/parseTsClassType.js.map +1 -1
  94. package/package.json +6 -5
@@ -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;AAC7B,OAAO,EACgE,cAAc,EAEpF,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAgB,MAAM,EAAE,MAAM,SAAS,CAAC;AAE/C,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,k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Y,YAAY;EAy4HzE;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
@@ -38,6 +38,21 @@ function isControlFlowNode(node) {
38
38
  function isCallExpression(node) {
39
39
  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
40
  }
41
+ // fast cheap unsafe checks
42
+ // 不判断空指针让它更快
43
+ const isCallFunction = (node) => node.concept === 'CallFunction';
44
+ const isCallLogic = (node) => node.concept === 'CallLogic' || node.concept === 'CallConnector';
45
+ const isCallInterface = (node) => node.concept === 'CallInterface' || node.concept === 'CallMicroserviceInterface' || node.concept === 'CallAuthInterface';
46
+ const isCallAuthInterface = (node) => node.concept === 'CallAuthInterface';
47
+ const isCallConnector = (node) => node.concept === 'CallConnector';
48
+ const isCallEvent = (node) => node.concept === 'CallEvent';
49
+ // order matters as for speed
50
+ const fastIsCallExpression = (node) => isCallLogic(node) || isCallFunction(node) || isCallEvent(node) || isCallInterface(node) || isCallAuthInterface(node) || isCallConnector(node);
51
+ const isEnd = (node) => node.concept === 'End';
52
+ const isAbort = (node) => node.concept === 'Abort';
53
+ const isBreak = (node) => node.concept === 'Break';
54
+ const isContinue = (node) => node.concept === 'Continue';
55
+ const fastIsControlFlowNode = (node) => isEnd(node) || isAbort(node) || isBreak(node) || isContinue(node);
41
56
  function getExpressionNodeName(concept) {
42
57
  const expressionNodeName = {
43
58
  CallFunction: '内置函数',
@@ -250,8 +265,9 @@ function createErrorDiagnoser(context) {
250
265
  const diagnosticMap = new Map();
251
266
  // 文件级别节点
252
267
  const fileNodes = [];
253
- let inPlayground = false;
268
+ let inPlayground = 0;
254
269
  let inAuthLogic = false;
270
+ let dbType = '';
255
271
  let curVarCounter = 0;
256
272
  /**
257
273
  * 获取当前文件节点
@@ -276,7 +292,7 @@ function createErrorDiagnoser(context) {
276
292
  if (diagnostics) {
277
293
  const diagnostic = {
278
294
  message,
279
- severity: inPlayground ? Severity.WARN : severity ?? Severity.ERROR,
295
+ severity: inPlayground > 0 ? Severity.WARN : severity ?? Severity.ERROR,
280
296
  ...others,
281
297
  };
282
298
  if (isDebug) {
@@ -702,18 +718,18 @@ function createErrorDiagnoser(context) {
702
718
  error(node, `预期 ${minArgsCount} 个参数,但传入了 ${argsLen} 个。`);
703
719
  }
704
720
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(args, function* (arg, index) {
705
- arg.paramRequired = true;
706
721
  const param = params?.[index];
707
- if ((hasSpreadParam && index > spreadParamIndex) || isNonRequiredParam(param)) {
708
- arg.paramRequired = false;
709
- }
722
+ const isParamRequired = !(hasSpreadParam && index > spreadParamIndex) && !isNonRequiredParam(param);
723
+ arg.paramRequired = isParamRequired;
724
+ if (!param)
725
+ return;
710
726
  const paramType = (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?.length !== paramTypeArgs?.length) {
716
- error(node, `高阶函数: 参数个数不匹配,期望 ${paramTypeArgs.length} 个, 实际传入 ${argTypeArgs?.length || 0} 个!`);
731
+ if (argTypeArgs.length !== paramTypeArgs.length) {
732
+ error(node, `高阶函数: 参数个数不匹配,期望 ${paramTypeArgs.length} 个, 实际传入 ${argTypeArgs.length} 个!`);
717
733
  }
718
734
  }
719
735
  });
@@ -781,11 +797,11 @@ function createErrorDiagnoser(context) {
781
797
  */
782
798
  function* checkPlayground(playground) {
783
799
  if (playground?.length) {
784
- inPlayground = true;
800
+ inPlayground++;
785
801
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(playground, function* (node) {
786
802
  yield* checkNode(node);
787
803
  });
788
- inPlayground = false;
804
+ inPlayground--;
789
805
  }
790
806
  }
791
807
  /**
@@ -1178,6 +1194,7 @@ function createErrorDiagnoser(context) {
1178
1194
  * @param node
1179
1195
  */
1180
1196
  function* checkDataSource(node) {
1197
+ dbType = node.dataSourceSqlType;
1181
1198
  if (node.entities?.length) {
1182
1199
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.entities, function* (node) {
1183
1200
  yield* checkNode(node);
@@ -1230,6 +1247,7 @@ function createErrorDiagnoser(context) {
1230
1247
  if (duplidateEntities.length) {
1231
1248
  error(node, `数据源${node.name}存在重名实体:${duplidateEntities.join(', ')}`);
1232
1249
  }
1250
+ dbType = '';
1233
1251
  }
1234
1252
  /**
1235
1253
  * 检查 实体
@@ -1254,6 +1272,69 @@ function createErrorDiagnoser(context) {
1254
1272
  error(node, '共享范围为指定应用时,必须指定共享应用');
1255
1273
  }
1256
1274
  }
1275
+ function getCurrentDataBaseType(node) {
1276
+ if (node.databaseTypeAnnotation) {
1277
+ const databaseTypeMap = node.dataBaseTypeMap || {};
1278
+ const { typeName } = node.databaseTypeAnnotation;
1279
+ return databaseTypeMap[typeName];
1280
+ }
1281
+ const { typeName } = node.typeAnnotation;
1282
+ if (typeName === 'String') {
1283
+ const defaultDataBaseName = getInferredDefaultDataBaseName(node);
1284
+ if (defaultDataBaseName && defaultDataBaseName !== node.defaultDataBaseType?.type) {
1285
+ return {
1286
+ ...(node.dataBaseTypeMap?.[defaultDataBaseName] ?? {}),
1287
+ };
1288
+ }
1289
+ }
1290
+ return node.defaultDataBaseType;
1291
+ }
1292
+ function getInferredDefaultDataBaseName(ndoe) {
1293
+ let defaultDataBaseName;
1294
+ const { typeName } = ndoe.typeAnnotation;
1295
+ if (typeName === 'String') {
1296
+ const dataSourceSqlType = dbType;
1297
+ let maxLength;
1298
+ const { rules } = ndoe;
1299
+ if (Array.isArray(rules)) {
1300
+ // 是否需要更新规则
1301
+ rules.forEach((rule) => {
1302
+ const match = rule.match(/^([^()]+)\(([\d\-.]+)\)$/);
1303
+ if (match) {
1304
+ const [, key, value] = match;
1305
+ if (key === 'maxLength') {
1306
+ maxLength = value;
1307
+ }
1308
+ }
1309
+ });
1310
+ }
1311
+ // 不同数据库 最大长度 短、中、长 对应的默认储存类型
1312
+ const sqlMap = {
1313
+ mysql: {
1314
+ 255: 'varchar',
1315
+ 4000: 'text',
1316
+ 16777215: 'mediumtext',
1317
+ },
1318
+ oracle: {
1319
+ 255: 'varchar2',
1320
+ 4000: 'clob',
1321
+ 16777215: 'clob',
1322
+ },
1323
+ dameng: {
1324
+ 255: 'varchar2',
1325
+ 4000: 'text',
1326
+ 16777215: 'text',
1327
+ },
1328
+ db2: {
1329
+ 255: 'varchar',
1330
+ 4000: 'clob',
1331
+ 16777215: 'clob',
1332
+ },
1333
+ };
1334
+ defaultDataBaseName = sqlMap?.[dataSourceSqlType]?.[maxLength];
1335
+ }
1336
+ return defaultDataBaseName;
1337
+ }
1257
1338
  /**
1258
1339
  * 检查 实体属性
1259
1340
  * @param node
@@ -1262,7 +1343,6 @@ function createErrorDiagnoser(context) {
1262
1343
  yield* checkNode(node.defaultValue);
1263
1344
  yield* checkNode(node.typeAnnotation);
1264
1345
  const entity = node.getAncestor('Entity');
1265
- const dbType = entity.dataSource.dataSourceSqlType;
1266
1346
  const { origin } = entity || {};
1267
1347
  if (dbType && !['excel', 'table'].includes(origin)) {
1268
1348
  const { typeAnnotation, databaseTypeAnnotation, rules } = node;
@@ -1277,7 +1357,7 @@ function createErrorDiagnoser(context) {
1277
1357
  });
1278
1358
  }
1279
1359
  let message = '';
1280
- const dataBaseTyp = node.currentDataBaseType;
1360
+ const dataBaseTyp = getCurrentDataBaseType(node);
1281
1361
  if (!dataBaseTyp && databaseTypeAnnotation) {
1282
1362
  const { typeName: databaseTypeName } = databaseTypeAnnotation;
1283
1363
  const errorMsg = `平台目前暂不支持${dbType}数据库的${databaseTypeName}存储类型`;
@@ -1822,6 +1902,10 @@ function createErrorDiagnoser(context) {
1822
1902
  * @param node
1823
1903
  */
1824
1904
  function* checkViewElement(node) {
1905
+ // lcap-login 组件需要完全不做任何检查,不报任何错误。里面一大堆脏数据。
1906
+ if (node.tag === 'lcap-login') {
1907
+ return;
1908
+ }
1825
1909
  const shouldProvideCurrentCtx = !!(node.slotScope);
1826
1910
  let unbindVariables;
1827
1911
  if (shouldProvideCurrentCtx) {
@@ -1875,10 +1959,9 @@ function createErrorDiagnoser(context) {
1875
1959
  const isTempWarningMode = node.parentNode?.concept === 'ViewElement' &&
1876
1960
  node.parentNode?.tag === 'u-table-view-expander';
1877
1961
  if (isTempWarningMode) {
1878
- const oldInPlayground = inPlayground;
1879
- inPlayground = true;
1962
+ inPlayground++;
1880
1963
  yield* checkNode(node.expression);
1881
- inPlayground = oldInPlayground;
1964
+ inPlayground--;
1882
1965
  }
1883
1966
  else {
1884
1967
  yield* checkNode(node.expression);
@@ -2575,7 +2658,7 @@ function createErrorDiagnoser(context) {
2575
2658
  return;
2576
2659
  }
2577
2660
  const ref = env.resolvedCallTypeBindings.get(node) ?? env.resolveRef(node);
2578
- if (ref) {
2661
+ if (ref && !(0, typer_1.isUnResolvedTy)(ref)) {
2579
2662
  // 检查使用范围
2580
2663
  yield* checkScopeOfUse(node, ref);
2581
2664
  yield* checkCallExpressionParameters(node, ref);
@@ -2910,7 +2993,7 @@ function createErrorDiagnoser(context) {
2910
2993
  * @param node
2911
2994
  */
2912
2995
  function* checkMatchCase(node) {
2913
- const match = node.getAncestor('Match');
2996
+ const match = toRaw(node.getAncestor('Match'));
2914
2997
  if (node.patterns?.length) {
2915
2998
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.patterns, function* (node) {
2916
2999
  yield* checkNode(node);
@@ -2923,7 +3006,7 @@ function createErrorDiagnoser(context) {
2923
3006
  // 先使用ts原始的报错,这个先注释掉
2924
3007
  if (nasl_concepts_1.asserts.isTypeAnnotation(node) && matchExpressionType?.typeKind === 'union') {
2925
3008
  (0, service_1.transformUnionTypeAnnotation)(matchExpressionType, match?.app);
2926
- const haveType = matchExpressionType?.typeArguments.find((item) => item.sortedTypeKey === node.sortedTypeKey);
3009
+ const haveType = !!matchExpressionType?.typeArguments?.some(item => env.isEq(item, node));
2927
3010
  if (!haveType) {
2928
3011
  message = '匹配:选择类型不存在';
2929
3012
  titleTip = '该类型已被删除';
@@ -3729,12 +3812,8 @@ function createErrorDiagnoser(context) {
3729
3812
  }
3730
3813
  function* dispatchNode(node) {
3731
3814
  try {
3732
- // 控制流节点
3733
- if (isControlFlowNode(node)) {
3734
- return yield* checkControlFlowNode(node);
3735
- }
3736
3815
  // 调用表达式
3737
- if (isCallExpression(node)) {
3816
+ if (fastIsCallExpression(node)) {
3738
3817
  return yield* checkCallExpression(node);
3739
3818
  }
3740
3819
  const { concept } = node;
@@ -3954,9 +4033,13 @@ function createErrorDiagnoser(context) {
3954
4033
  case 'Start':
3955
4034
  return;
3956
4035
  case 'SqlQueryComponent':
3957
- return;
4036
+ return env.getType(node);
3958
4037
  default:
3959
- console.log(node);
4038
+ // isDebugMode && console.log(node);
4039
+ }
4040
+ // 控制流节点,低频或没啥人用的东西放后面判断
4041
+ if (fastIsControlFlowNode(node)) {
4042
+ return yield* checkControlFlowNode(node);
3960
4043
  }
3961
4044
  }
3962
4045
  catch (err) {
@@ -3969,6 +4052,7 @@ function createErrorDiagnoser(context) {
3969
4052
  * @returns 清理函数
3970
4053
  */
3971
4054
  function handleFileNode(node) {
4055
+ // TODO: checkNodeIsFileModuleInIde 也慢,后续可以优化
3972
4056
  const isFileModule = fileNodes.length ? (0, service_1.checkNodeIsFileModuleInIde)(node) : true;
3973
4057
  if (isFileModule) {
3974
4058
  fileNodes.push(node);
@@ -3988,7 +4072,8 @@ function createErrorDiagnoser(context) {
3988
4072
  * @returns
3989
4073
  */
3990
4074
  function* checkNode(node) {
3991
- if (!nasl_concepts_1.asserts.isBaseNode(node)) {
4075
+ // fast weak basenode check
4076
+ if (!node || !node.concept) {
3992
4077
  return;
3993
4078
  }
3994
4079
  const cleanup = handleFileNode(node);
@@ -4096,4 +4181,6 @@ const transformDiagnosticsToRecords = (fileNode, diagnostics) => {
4096
4181
  return records;
4097
4182
  };
4098
4183
  exports.transformDiagnosticsToRecords = transformDiagnosticsToRecords;
4184
+ // @ts-expect-error
4185
+ const toRaw = (nd) => nd.__v_raw ?? nd;
4099
4186
  //# sourceMappingURL=checker.js.map