@lcap/nasl-language-server-core 3.14.0-rc.1 → 3.14.0-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.
Files changed (78) hide show
  1. package/out/checker.d.ts.map +1 -1
  2. package/out/checker.js +19 -10
  3. package/out/checker.js.map +1 -1
  4. package/out/index.d.ts +1 -0
  5. package/out/index.d.ts.map +1 -1
  6. package/out/index.js +1 -0
  7. package/out/index.js.map +1 -1
  8. package/out/reference-manager/collect-q-name.js +1 -1
  9. package/out/reference-manager/collect-q-name.js.map +1 -1
  10. package/out/reference-manager/get-q-name.d.ts +1 -1
  11. package/out/reference-manager/get-q-name.d.ts.map +1 -1
  12. package/out/reference-manager/get-q-name.js +4 -4
  13. package/out/reference-manager/get-q-name.js.map +1 -1
  14. package/out/reference-manager/reference-manager.d.ts +7 -8
  15. package/out/reference-manager/reference-manager.d.ts.map +1 -1
  16. package/out/reference-manager/reference-manager.js +23 -17
  17. package/out/reference-manager/reference-manager.js.map +1 -1
  18. package/out/reference-manager/remove-q-name.js +1 -1
  19. package/out/reference-manager/remove-q-name.js.map +1 -1
  20. package/out/typer/component-def-manager/component-def-manager.d.ts +11 -3
  21. package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
  22. package/out/typer/component-def-manager/component-def-manager.js +79 -18
  23. package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
  24. package/out/typer/component-def-manager/utils.d.ts.map +1 -1
  25. package/out/typer/component-def-manager/utils.js +6 -0
  26. package/out/typer/component-def-manager/utils.js.map +1 -1
  27. package/out/typer/dispatch-all.js +1 -1
  28. package/out/typer/dispatch-all.js.map +1 -1
  29. package/out/typer/dispatch-def.js +5 -5
  30. package/out/typer/dispatch-def.js.map +1 -1
  31. package/out/typer/dispatch-expr.d.ts.map +1 -1
  32. package/out/typer/dispatch-expr.js +35 -21
  33. package/out/typer/dispatch-expr.js.map +1 -1
  34. package/out/typer/dispatch-process.d.ts.map +1 -1
  35. package/out/typer/dispatch-process.js +3 -2
  36. package/out/typer/dispatch-process.js.map +1 -1
  37. package/out/typer/dispatch-stmt.d.ts.map +1 -1
  38. package/out/typer/dispatch-stmt.js +4 -4
  39. package/out/typer/dispatch-stmt.js.map +1 -1
  40. package/out/typer/dispatch-view.d.ts.map +1 -1
  41. package/out/typer/dispatch-view.js +62 -8
  42. package/out/typer/dispatch-view.js.map +1 -1
  43. package/out/typer/incremental-update.d.ts.map +1 -1
  44. package/out/typer/incremental-update.js +11 -7
  45. package/out/typer/incremental-update.js.map +1 -1
  46. package/out/typer/subster.d.ts +3 -3
  47. package/out/typer/subster.d.ts.map +1 -1
  48. package/out/typer/subster.js +14 -12
  49. package/out/typer/subster.js.map +1 -1
  50. package/out/typer/type-hint-manager/type-hint-manager.d.ts +1 -1
  51. package/out/typer/type-hint-manager/type-hint-manager.d.ts.map +1 -1
  52. package/out/typer/type-hint-manager/type-hint-manager.js +4 -4
  53. package/out/typer/type-hint-manager/type-hint-manager.js.map +1 -1
  54. package/out/typer/type-manager.d.ts +2 -1
  55. package/out/typer/type-manager.d.ts.map +1 -1
  56. package/out/typer/type-manager.js +35 -3
  57. package/out/typer/type-manager.js.map +1 -1
  58. package/out/typer/typer.d.ts +11 -0
  59. package/out/typer/typer.d.ts.map +1 -1
  60. package/out/typer/typer.js +29 -10
  61. package/out/typer/typer.js.map +1 -1
  62. package/out/typer/unifier.d.ts +3 -1
  63. package/out/typer/unifier.d.ts.map +1 -1
  64. package/out/typer/unifier.js +25 -51
  65. package/out/typer/unifier.js.map +1 -1
  66. package/out/utils/error-boundary.d.ts +1 -1
  67. package/out/utils/error-boundary.d.ts.map +1 -1
  68. package/out/utils/error-boundary.js +14 -13
  69. package/out/utils/error-boundary.js.map +1 -1
  70. package/out/utils/file-node-cache.d.ts +12 -0
  71. package/out/utils/file-node-cache.d.ts.map +1 -0
  72. package/out/utils/file-node-cache.js +30 -0
  73. package/out/utils/file-node-cache.js.map +1 -0
  74. package/out/utils/type-operator.d.ts +5 -5
  75. package/out/utils/type-operator.d.ts.map +1 -1
  76. package/out/utils/type-operator.js +46 -26
  77. package/out/utils/type-operator.js.map +1 -1
  78. package/package.json +5 -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;AAE7B,OAAO,EACgE,cAAc,EAEpF,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EAA4B,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAIhE,OAAO,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEpE,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,EA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,6BAA6B,aAAc,UAAU,sCAAoC,MAAM,gBAAgB,CAmC3H,CAAA;AAMD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
package/out/checker.js CHANGED
@@ -4,6 +4,7 @@ exports.transformDiagnosticsToRecords = exports.createErrorDiagnoser = exports.S
4
4
  const decimal_js_1 = require("decimal.js");
5
5
  const nasl_concepts_1 = require("@lcap/nasl-concepts");
6
6
  const service_1 = require("@lcap/nasl-concepts/service");
7
+ const file_node_cache_1 = require("./utils/file-node-cache");
7
8
  const nasl_utils_1 = require("@lcap/nasl-utils");
8
9
  const typer_1 = require("./typer");
9
10
  const type_predicate_1 = require("./typer/type-predicate");
@@ -561,7 +562,7 @@ function createErrorDiagnoser(context) {
561
562
  // 允许在当前业务组件中访问
562
563
  businessComponent,
563
564
  ],
564
- errMsg: `“${node.name}”是私有的,只能在“${businessComponent.name}”中访问。`,
565
+ errMsg: `"${node.name}"是私有的,只能在"${businessComponent.name}"中访问。`,
565
566
  } : null;
566
567
  case 'ConfigProperty':
567
568
  return node.isPrivate ? {
@@ -1023,8 +1024,8 @@ function createErrorDiagnoser(context) {
1023
1024
  const status = getStatusOfSharedApp(node);
1024
1025
  if (status) {
1025
1026
  const msgMap = {
1026
- update: `共享数据 ${node.name} 已在“${node.provider}应用”中更新,请同步更新`,
1027
- delete: `共享数据 ${node.name} 已在“${node.provider}应用”中被删除,请同步删除`,
1027
+ update: `共享数据 ${node.name} 已在"${node.provider}应用"中更新,请同步更新`,
1028
+ delete: `共享数据 ${node.name} 已在"${node.provider}应用"中被删除,请同步删除`,
1028
1029
  };
1029
1030
  error(node, msgMap[status], {
1030
1031
  severity: Severity.WARN,
@@ -2702,19 +2703,27 @@ function createErrorDiagnoser(context) {
2702
2703
  return;
2703
2704
  }
2704
2705
  const ref = env.resolvedCallInfo.get(node) ?? env.resolveRef(node);
2706
+ const typeUnresolved = ref.ret
2707
+ ? (0, type_manager_1.hasUnresolvedTyInCallInfo)(ref) // 其他
2708
+ : (0, type_predicate_1.isUnResolvedTy)(ref); // 前端页面,TODO: 需要统一处理
2705
2709
  // Handle the new FunctionDefinition structure
2706
- if (ref?.params && !(0, type_manager_1.hasUnresolvedTyInCallInfo)(ref)) {
2710
+ if (ref?.params && !typeUnresolved) {
2707
2711
  // It's a FunctionDefinition object
2708
2712
  yield* checkScopeOfUse(node, ref);
2709
2713
  yield* checkCallExpressionParameters(node, ref);
2710
2714
  }
2711
- else if (ref && !(0, type_predicate_1.isUnResolvedTy)(ref)) {
2715
+ else if (ref && !typeUnresolved) {
2712
2716
  // 检查使用范围
2713
2717
  yield* checkScopeOfUse(node, ref);
2714
2718
  yield* checkCallExpressionParameters(node, ref);
2715
2719
  }
2716
2720
  else {
2717
- error(node, `找不到${getExpressionNodeName(node.concept)} ${node.calleeName}。`);
2721
+ if (ref.depLibName) {
2722
+ error(node, `找不到依赖库 ${ref.depLibName} 上的 ${getExpressionNodeName(node.concept)} ${node.calleeName}。`);
2723
+ }
2724
+ else {
2725
+ error(node, `找不到${getExpressionNodeName(node.concept)} ${node.calleeName}。`);
2726
+ }
2718
2727
  return errorType;
2719
2728
  }
2720
2729
  switch (node.concept) {
@@ -3444,7 +3453,7 @@ function createErrorDiagnoser(context) {
3444
3453
  if (ensureNodeKeyExists(node, 'members')) {
3445
3454
  if (node.members?.length) {
3446
3455
  yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.members, function* (node) {
3447
- yield* checkNode(node);
3456
+ yield* checkNode(toRaw(node));
3448
3457
  });
3449
3458
  }
3450
3459
  }
@@ -3839,7 +3848,7 @@ function createErrorDiagnoser(context) {
3839
3848
  }
3840
3849
  // 元数据
3841
3850
  if (!metadataTypeEnable && node.typeNamespace?.endsWith('.metadataTypes')) {
3842
- error(node, '未启用元数据功能,请在“偏好设置”中启用元数据。');
3851
+ error(node, '未启用元数据功能,请在"偏好设置"中启用元数据。');
3843
3852
  }
3844
3853
  if (node.typeArguments?.length) {
3845
3854
  // 有同名的
@@ -4117,8 +4126,8 @@ function createErrorDiagnoser(context) {
4117
4126
  * @returns 清理函数
4118
4127
  */
4119
4128
  function handleFileNode(node) {
4120
- // TODO: checkNodeIsFileModuleInIde 也慢,后续可以优化
4121
- const isFileModule = fileNodes.length ? (0, service_1.checkNodeIsFileModuleInIde)(node) : true;
4129
+ // TODO: checkNodeIsFileModuleInIdeWithCache 也慢,后续可以优化
4130
+ const isFileModule = fileNodes.length ? (0, file_node_cache_1.checkNodeIsFileModuleInIdeWithCache)(node) : true;
4122
4131
  if (isFileModule) {
4123
4132
  fileNodes.push(node);
4124
4133
  let diagnostics = diagnosticMap.get(node);