@lcap/nasl-language-server-core 4.4.0-beta.33 → 4.4.0-beta.35
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 +27 -13
- package/out/checker.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +55 -7
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +65 -7
- package/out/typer/component-def-manager/component-def-manager.d.ts.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.js +400 -8
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +326 -142
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +80 -29
- package/out/typer/subster.js.map +1 -1
- package/out/typer/type-predicate.d.ts +14 -1
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +303 -3
- 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.map +1 -1
- package/out/typer/unifier.d.ts +8 -0
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +32 -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,M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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
|
}
|
|
@@ -792,24 +794,27 @@ function createErrorDiagnoser(context) {
|
|
|
792
794
|
return false;
|
|
793
795
|
}
|
|
794
796
|
/**
|
|
795
|
-
* 获取 ViewElement
|
|
796
|
-
*
|
|
797
|
+
* 获取 ViewElement 的数据源类型
|
|
798
|
+
* 基于 __ViewElementTV 中存储的 role === 'dataItem' 查找,优先返回有自有数据源的 dataItem。
|
|
797
799
|
*/
|
|
798
800
|
function getDataSourceTypeAnnotation(viewElement) {
|
|
799
|
-
// 向上查找定义了数据源类型的祖先组件
|
|
800
801
|
let currentNode = viewElement;
|
|
801
802
|
let depth = 0;
|
|
802
803
|
const maxSearchDepth = 5;
|
|
803
804
|
while (currentNode?.concept === 'ViewElement' && depth <= maxSearchDepth) {
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
805
|
+
if (currentNode.__ViewElementTV?.length) {
|
|
806
|
+
// 优先查找有自有数据源的 dataItem(如动态列的 T1)
|
|
807
|
+
for (const tv of currentNode.__ViewElementTV) {
|
|
808
|
+
if (tv.role === 'dataItem' && tv.hasOwnDataSource && tv.renamed) {
|
|
809
|
+
return tv.renamed;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
// 兜底查找无自有数据源的 dataItem(如子组件继承的 T)
|
|
813
|
+
for (const tv of currentNode.__ViewElementTV) {
|
|
814
|
+
if (tv.role === 'dataItem' && tv.renamed) {
|
|
815
|
+
return tv.renamed;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
813
818
|
}
|
|
814
819
|
currentNode = currentNode.parentNode;
|
|
815
820
|
depth++;
|
|
@@ -4147,6 +4152,9 @@ function createErrorDiagnoser(context) {
|
|
|
4147
4152
|
*/
|
|
4148
4153
|
function* checkNewList(node) {
|
|
4149
4154
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4155
|
+
if (node.typeAnnotation) {
|
|
4156
|
+
yield* checkNode(node.typeAnnotation);
|
|
4157
|
+
}
|
|
4150
4158
|
// 匿名函数返回值有可能是newList,需要过滤。代码来源:AnonymousFunction.__ts
|
|
4151
4159
|
const grandParent = node.parentNode?.parentNode?.parentNode;
|
|
4152
4160
|
if (isEntityUpdate(grandParent)) {
|
|
@@ -4184,6 +4192,9 @@ function createErrorDiagnoser(context) {
|
|
|
4184
4192
|
*/
|
|
4185
4193
|
function* checkNewMap(node) {
|
|
4186
4194
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4195
|
+
if (node.typeAnnotation) {
|
|
4196
|
+
yield* checkNode(node.typeAnnotation);
|
|
4197
|
+
}
|
|
4187
4198
|
if (node.keys?.length) {
|
|
4188
4199
|
yield* (0, nasl_utils_1.wrapForEachToGenerator)(node.keys, function* (node) {
|
|
4189
4200
|
yield* checkNode(node);
|
|
@@ -4222,6 +4233,9 @@ function createErrorDiagnoser(context) {
|
|
|
4222
4233
|
*/
|
|
4223
4234
|
function* checkNewComposite(node) {
|
|
4224
4235
|
yield* semantic_rules_1.ExtraSemanticRules.rejectFileTypes(node, env, error);
|
|
4236
|
+
if (node.typeAnnotation) {
|
|
4237
|
+
yield* checkNode(node.typeAnnotation);
|
|
4238
|
+
}
|
|
4225
4239
|
ensureNodeKeyExists(node, 'typeAnnotation');
|
|
4226
4240
|
const type = env.getType(node);
|
|
4227
4241
|
if (node.properties?.length) {
|