@lcap/nasl-language-server-core 4.0.0-rc.3 → 4.0.0-rc.5
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 +88 -34
- package/out/checker.js.map +1 -1
- package/out/index.d.ts +1 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -1
- package/out/index.js.map +1 -1
- package/out/reference-manager/builtin-q-name.d.ts +8 -1
- package/out/reference-manager/builtin-q-name.d.ts.map +1 -1
- package/out/reference-manager/builtin-q-name.js +55 -1
- package/out/reference-manager/builtin-q-name.js.map +1 -1
- package/out/reference-manager/collect-q-name.d.ts +2 -1
- package/out/reference-manager/collect-q-name.d.ts.map +1 -1
- package/out/reference-manager/collect-q-name.js +9 -3
- package/out/reference-manager/collect-q-name.js.map +1 -1
- package/out/reference-manager/get-q-name.d.ts.map +1 -1
- package/out/reference-manager/get-q-name.js +2 -0
- package/out/reference-manager/get-q-name.js.map +1 -1
- package/out/reference-manager/reference-manager.d.ts +4 -1
- package/out/reference-manager/reference-manager.d.ts.map +1 -1
- package/out/reference-manager/reference-manager.js +197 -54
- package/out/reference-manager/reference-manager.js.map +1 -1
- package/out/reference-manager/remove-q-name.d.ts +2 -1
- package/out/reference-manager/remove-q-name.d.ts.map +1 -1
- package/out/reference-manager/remove-q-name.js +11 -3
- package/out/reference-manager/remove-q-name.js.map +1 -1
- package/out/reference-manager/rename-q-name.d.ts +2 -1
- package/out/reference-manager/rename-q-name.d.ts.map +1 -1
- package/out/reference-manager/rename-q-name.js +11 -2
- package/out/reference-manager/rename-q-name.js.map +1 -1
- package/out/reference-manager/symbol-type.d.ts +4 -3
- package/out/reference-manager/symbol-type.d.ts.map +1 -1
- package/out/reference-manager/symbol-type.js +6 -2
- package/out/reference-manager/symbol-type.js.map +1 -1
- package/out/typer/collectGlobalDefs.d.ts.map +1 -1
- package/out/typer/collectGlobalDefs.js +79 -15
- package/out/typer/collectGlobalDefs.js.map +1 -1
- package/out/typer/component-def-manager/component-def-manager.d.ts +11 -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 +17 -6
- package/out/typer/component-def-manager/component-def-manager.js.map +1 -1
- package/out/typer/dispatch-def.d.ts +0 -2
- package/out/typer/dispatch-def.d.ts.map +1 -1
- package/out/typer/dispatch-def.js +11 -39
- 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 +68 -68
- package/out/typer/dispatch-expr.js.map +1 -1
- package/out/typer/dispatch-process.d.ts.map +1 -1
- package/out/typer/dispatch-process.js +4 -2
- package/out/typer/dispatch-process.js.map +1 -1
- package/out/typer/dispatch-stmt.d.ts.map +1 -1
- package/out/typer/dispatch-stmt.js +26 -20
- package/out/typer/dispatch-stmt.js.map +1 -1
- package/out/typer/dispatch-view.d.ts.map +1 -1
- package/out/typer/dispatch-view.js +6 -3
- package/out/typer/dispatch-view.js.map +1 -1
- package/out/typer/incremental-update.d.ts +1 -1
- package/out/typer/incremental-update.d.ts.map +1 -1
- package/out/typer/incremental-update.js +18 -14
- package/out/typer/incremental-update.js.map +1 -1
- package/out/typer/index.d.ts +3 -4
- package/out/typer/index.d.ts.map +1 -1
- package/out/typer/index.js +4 -4
- package/out/typer/index.js.map +1 -1
- package/out/typer/sem-diag.d.ts +1 -0
- package/out/typer/sem-diag.d.ts.map +1 -1
- package/out/typer/sem-diag.js +24 -17
- package/out/typer/sem-diag.js.map +1 -1
- package/out/typer/solver.d.ts +1 -0
- package/out/typer/solver.d.ts.map +1 -1
- package/out/typer/solver.js +9 -1
- package/out/typer/solver.js.map +1 -1
- package/out/typer/subster.d.ts.map +1 -1
- package/out/typer/subster.js +20 -6
- package/out/typer/subster.js.map +1 -1
- package/out/typer/type-manager.d.ts +1 -2
- package/out/typer/type-manager.d.ts.map +1 -1
- package/out/typer/type-manager.js +22 -17
- package/out/typer/type-manager.js.map +1 -1
- package/out/typer/type-predicate.d.ts +2 -0
- package/out/typer/type-predicate.d.ts.map +1 -1
- package/out/typer/type-predicate.js +8 -6
- package/out/typer/type-predicate.js.map +1 -1
- package/out/typer/typer.d.ts +14 -2
- package/out/typer/typer.d.ts.map +1 -1
- package/out/typer/typer.js +23 -5
- package/out/typer/typer.js.map +1 -1
- package/out/typer/unifier.d.ts.map +1 -1
- package/out/typer/unifier.js +38 -28
- package/out/typer/unifier.js.map +1 -1
- package/out/utils/parseTsClassType.d.ts +2 -0
- package/out/utils/parseTsClassType.d.ts.map +1 -1
- package/out/utils/parseTsClassType.js +4 -2
- package/out/utils/parseTsClassType.js.map +1 -1
- package/out/utils/type-operator.d.ts +1 -1
- package/out/utils/type-operator.d.ts.map +1 -1
- package/out/utils/type-operator.js +18 -3
- package/out/utils/type-operator.js.map +1 -1
- package/package.json +5 -5
|
@@ -84,7 +84,8 @@ function tpPaginate(env, nd, tgtTy) {
|
|
|
84
84
|
// 分页返回的似乎是 { list:..., total: Integer }
|
|
85
85
|
env.setType(nd, (0, type_manager_1.createAnonymousTyAnn)(['list', 'total'], [env.getRawType(nd.list),
|
|
86
86
|
type_manager_1.naslLongTy]));
|
|
87
|
-
//
|
|
87
|
+
// 暂时应该不会有这种奇葩的推导,省一点是一点: ==> 现在加上吧,赋值那边的额外 unify 可以完全去掉
|
|
88
|
+
env.unifier.unify(env.getRawType(nd), tgtTy);
|
|
88
89
|
return env.getRawType(nd);
|
|
89
90
|
}
|
|
90
91
|
function tpNullLiteral(env, nd, tgtTy) {
|
|
@@ -94,9 +95,6 @@ function tpNullLiteral(env, nd, tgtTy) {
|
|
|
94
95
|
return type_manager_1.naslNullTy;
|
|
95
96
|
}
|
|
96
97
|
function tpDefaultValue(env, nd, tgtTy) {
|
|
97
|
-
if (nd.playground) {
|
|
98
|
-
(0, dispatch_stmt_1.tpSolvingPlayground)(env, nd.playground);
|
|
99
|
-
}
|
|
100
98
|
if (nd.expression) {
|
|
101
99
|
// Date 系列的东西默认值都是 StringLiteral,所以这里要特殊处理。
|
|
102
100
|
if ((0, type_predicate_2.isDateTy)(tgtTy) || (0, type_predicate_2.isTimeTy)(tgtTy) || (0, type_predicate_2.isDateTimeTy)(tgtTy)) {
|
|
@@ -119,6 +117,7 @@ function tpDefaultValue(env, nd, tgtTy) {
|
|
|
119
117
|
}
|
|
120
118
|
// 大有讲究:敢信现在 let x: Decimal = 0 的 0 是 Decimal 类型(与逻辑里不同)
|
|
121
119
|
env.setType(nd, tgtTy ?? env.getRawType(nd.expression));
|
|
120
|
+
(0, dispatch_stmt_1.tpSolvingPlayground)(env, nd.playground);
|
|
122
121
|
return env.getRawType(nd);
|
|
123
122
|
}
|
|
124
123
|
function tpStringLiteral(env, nd, tgtTy) {
|
|
@@ -185,13 +184,6 @@ function tpIdentifier(env, nd, tgtTy) {
|
|
|
185
184
|
env.setType(nd, tgtTy);
|
|
186
185
|
return;
|
|
187
186
|
}
|
|
188
|
-
// a.b.c 中的 b 和 c 不应指向局部变量
|
|
189
|
-
if (!env.isInMemberExpr && (0, nasl_predicate_1.isTypeInferConcept)(def)) {
|
|
190
|
-
nd.pointToSymbol = def;
|
|
191
|
-
}
|
|
192
|
-
else if (nd.pointToSymbol) {
|
|
193
|
-
nd.pointToSymbol = undefined;
|
|
194
|
-
}
|
|
195
187
|
let refTy = env.getRawType(def);
|
|
196
188
|
if (refTy) {
|
|
197
189
|
env.setType(nd, refTy);
|
|
@@ -201,8 +193,17 @@ function tpIdentifier(env, nd, tgtTy) {
|
|
|
201
193
|
env.setType(nd, freshTy);
|
|
202
194
|
env.setType(def, freshTy);
|
|
203
195
|
}
|
|
204
|
-
env.
|
|
205
|
-
|
|
196
|
+
const ndTy = env.getRawType(nd);
|
|
197
|
+
// a.b.c 中的 b 和 c 不应指向局部变量、不收集草稿区的推导
|
|
198
|
+
if (!env.isInMemberExpr && (0, nasl_predicate_1.isTypeInferConcept)(def)) {
|
|
199
|
+
env.idToVar.set(nd, def);
|
|
200
|
+
!env.isPlayground && env.allRefsInPlayground.delete(def);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
env.idToVar.delete(nd);
|
|
204
|
+
}
|
|
205
|
+
env.unifier.unify(ndTy, tgtTy);
|
|
206
|
+
return ndTy;
|
|
206
207
|
}
|
|
207
208
|
function tpMemberExpression(env, nd, tgtTy) {
|
|
208
209
|
let rawObjTyAnn = undefined;
|
|
@@ -358,9 +359,6 @@ function tpBinaryArithExpr(env, nd, tgtTy) {
|
|
|
358
359
|
else if ((0, type_predicate_2.isIntegerTy)(rightTy)) {
|
|
359
360
|
env.unifier.unify(type_manager_1.naslLongTy, leftTy);
|
|
360
361
|
}
|
|
361
|
-
else {
|
|
362
|
-
env.unifier.unifyEq(leftTy, rightTy);
|
|
363
|
-
}
|
|
364
362
|
}
|
|
365
363
|
else if (!(0, type_predicate_2.isTyAnnTyParam)(leftTy) && (0, type_predicate_2.isTyAnnTyParam)(rightTy)) {
|
|
366
364
|
if ((0, type_predicate_2.isDecimalTy)(leftTy)) {
|
|
@@ -369,9 +367,6 @@ function tpBinaryArithExpr(env, nd, tgtTy) {
|
|
|
369
367
|
else if ((0, type_predicate_2.isIntegerTy)(leftTy)) {
|
|
370
368
|
env.unifier.unify(type_manager_1.naslLongTy, rightTy);
|
|
371
369
|
}
|
|
372
|
-
else {
|
|
373
|
-
env.unifier.unifyEq(rightTy, leftTy);
|
|
374
|
-
}
|
|
375
370
|
}
|
|
376
371
|
// 人肉 solve
|
|
377
372
|
const hasString = (0, type_predicate_2.isStringTy)(leftTy) || (0, type_predicate_2.isStringTy)(rightTy);
|
|
@@ -504,19 +499,27 @@ function tpPlusExpression(env: SemEnv, nd: BinaryExpression, tgtTy: TypeAnnotati
|
|
|
504
499
|
* == != 的检查也不好做
|
|
505
500
|
* (==): <T>(Null, T) -> Boolean
|
|
506
501
|
* (==): <T>(T, Null) -> Boolean
|
|
507
|
-
* (==): <T1 extends Integer | Decimal, T2 extends Integer | Decimal>(T1, T2) -> Boolean
|
|
502
|
+
* (==): <T1 extends Integer | Decimal, T2 extends Integer | Decimal>(T1, T2) -> Boolean ==> T1、T2 毫无关系
|
|
508
503
|
* (==): <T>(T, T) -> Boolean
|
|
509
504
|
*/
|
|
510
505
|
const tpBinaryComparisonExpr = (env, nd, tgtTy) => {
|
|
511
506
|
let leftTy = dispatchExpr(env, nd.left, undefined);
|
|
512
507
|
let rightTy = dispatchExpr(env, nd.right, undefined);
|
|
513
|
-
if ((0, type_predicate_2.isTyAnnTyParam)(rightTy)) {
|
|
514
|
-
rightTy
|
|
515
|
-
|
|
508
|
+
if ((0, type_predicate_2.isTyAnnTyParam)(leftTy) && !(0, type_predicate_2.isTyAnnTyParam)(rightTy)) {
|
|
509
|
+
if ((0, type_predicate_2.isDecimalTy)(rightTy)) {
|
|
510
|
+
env.unifier.unify(leftTy, type_manager_1.naslDecimalTy);
|
|
511
|
+
}
|
|
512
|
+
else if ((0, type_predicate_2.isIntegerTy)(rightTy)) {
|
|
513
|
+
env.unifier.unify(type_manager_1.naslLongTy, leftTy);
|
|
514
|
+
}
|
|
516
515
|
}
|
|
517
|
-
else if ((0, type_predicate_2.isTyAnnTyParam)(leftTy)) {
|
|
518
|
-
leftTy
|
|
519
|
-
|
|
516
|
+
else if (!(0, type_predicate_2.isTyAnnTyParam)(leftTy) && (0, type_predicate_2.isTyAnnTyParam)(rightTy)) {
|
|
517
|
+
if ((0, type_predicate_2.isDecimalTy)(leftTy)) {
|
|
518
|
+
env.unifier.unify(rightTy, type_manager_1.naslDecimalTy);
|
|
519
|
+
}
|
|
520
|
+
else if ((0, type_predicate_2.isIntegerTy)(leftTy)) {
|
|
521
|
+
env.unifier.unify(type_manager_1.naslLongTy, rightTy);
|
|
522
|
+
}
|
|
520
523
|
}
|
|
521
524
|
env.unifier.unify(type_manager_1.naslBooleanTy, tgtTy);
|
|
522
525
|
env.setType(nd, type_manager_1.naslBooleanTy);
|
|
@@ -686,7 +689,8 @@ function tpCallLogic(env, nd, tgtTy) {
|
|
|
686
689
|
env.setType(arg, parTy);
|
|
687
690
|
}
|
|
688
691
|
else {
|
|
689
|
-
//
|
|
692
|
+
// 报错:泛型逻辑调用,最后的 callInfo 里有 type variables,会被判定为 unresolved,目前不检查 arg 会缺少报错
|
|
693
|
+
// env.addError(`调用逻辑:参数不能为空`, env.getCurFileNode(), arg);
|
|
690
694
|
env.setType(arg, type_manager_1.naslAnyTy);
|
|
691
695
|
}
|
|
692
696
|
}
|
|
@@ -705,11 +709,21 @@ function tpCallLogic(env, nd, tgtTy) {
|
|
|
705
709
|
// 给 checker 报错用,都给吧,CallLogic 也有要处理 Error | T 返回类型的复杂情形,checker 直接拿结果就行不用重复处理
|
|
706
710
|
// TODO: 前端的部分组件逻辑好像指飞了(env.resoleRef 和 env.resolvedCallInfo 结果不一样)……先用 !env.isView 判断一下
|
|
707
711
|
if (!env.isView || nd.calleeNamespace === 'nasl.util') { // json 序列化 - similarly add param info for nasl.util
|
|
708
|
-
const callInfo = (0, type_manager_1.createFunctionDef)(fnTy.typeArguments, finalRetTy, def, fnTy.typeParams
|
|
709
|
-
nd.calleeNamespace.startsWith('extensions.') ? nd.calleeNamespace.split('.')[1] : undefined // 是否来自依赖库,TODO:目前只能优化服务端报错,页面的调用没有 callInfo
|
|
710
|
-
);
|
|
712
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(fnTy.typeArguments, finalRetTy, def, fnTy.typeParams);
|
|
711
713
|
env.resolvedCallInfo.set(nd, callInfo);
|
|
712
714
|
}
|
|
715
|
+
if (fnTy.typeParams?.length) {
|
|
716
|
+
env.addPostCheckTask(nd, (e, pSubst) => {
|
|
717
|
+
// 写入 __TypeArguments 字段,调用泛型依赖库时,代码生成要用。
|
|
718
|
+
const typeArgs = fnTy.typeParams
|
|
719
|
+
?.map((x) => {
|
|
720
|
+
return e.getType(pSubst(x));
|
|
721
|
+
})
|
|
722
|
+
.filter(types_1.isNotNil) ?? [];
|
|
723
|
+
// 写入来自:_getQuickInfoNodesTypeMapWithGenerator
|
|
724
|
+
nd.__TypeArguments = typeArgs;
|
|
725
|
+
});
|
|
726
|
+
}
|
|
713
727
|
return finalRetTy;
|
|
714
728
|
}
|
|
715
729
|
exports.tpCallLogic = tpCallLogic;
|
|
@@ -808,10 +822,8 @@ function tpCallFunction(env, nd, tgtTy) {
|
|
|
808
822
|
const fnTy = fnDef?.__TypeAnnotation;
|
|
809
823
|
(0, helper_1.zipWith_)(env.unifier.unify, argTys, fnTy?.typeArguments);
|
|
810
824
|
env.setType(nd, fnTy?.returnType?.[0] ?? type_manager_1.naslAnyTy); // 似乎不可能为空
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
env.resolvedCallInfo.set(nd, callInfo);
|
|
814
|
-
}
|
|
825
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(argTys, fnTy?.returnType?.[0] ?? type_manager_1.naslAnyTy, fnDef, undefined);
|
|
826
|
+
env.resolvedCallInfo.set(nd, callInfo);
|
|
815
827
|
return env.getRawType(nd);
|
|
816
828
|
}
|
|
817
829
|
const fnDef = env.quickGetLibDef(nd);
|
|
@@ -839,12 +851,9 @@ function tpCallFunction(env, nd, tgtTy) {
|
|
|
839
851
|
env.unifier.unify(finalRetTy, tgtTy);
|
|
840
852
|
// TODO:处理可选参数必填选填问题
|
|
841
853
|
env.setType(nd, finalRetTy); // 似乎不可能为空
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
);
|
|
846
|
-
env.resolvedCallInfo.set(nd, callInfo);
|
|
847
|
-
}
|
|
854
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(fnTy.typeArguments, finalRetTy, fnDef, // 内置函数
|
|
855
|
+
fnTy.typeParams);
|
|
856
|
+
env.resolvedCallInfo.set(nd, callInfo);
|
|
848
857
|
return finalRetTy;
|
|
849
858
|
function handleEnumFn(env, nd, tgtTy) {
|
|
850
859
|
const createAnonymousRetTy = (ty) => (0, type_manager_1.createAnonymousTyAnn)(['text', 'value'], [type_manager_1.naslStringTy, ty]);
|
|
@@ -952,15 +961,10 @@ function tpLengthAndConvertCall(env, nd, tgtTy) {
|
|
|
952
961
|
// For Length function, the parameter is required
|
|
953
962
|
// Create a mock definition for the Length function
|
|
954
963
|
const mockLengthDef = {
|
|
955
|
-
params: [{
|
|
956
|
-
name: 'collection',
|
|
957
|
-
optional: false
|
|
958
|
-
}]
|
|
964
|
+
params: [{ name: 'collection', optional: false }]
|
|
959
965
|
};
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
env.resolvedCallInfo.set(nd, callInfo); // 存储函数定义(含参数和返回类型)
|
|
963
|
-
}
|
|
966
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(argTys, type_manager_1.naslLongTy, mockLengthDef, undefined);
|
|
967
|
+
env.resolvedCallInfo.set(nd, callInfo); // 存储函数定义(含参数和返回类型)
|
|
964
968
|
return type_manager_1.naslLongTy;
|
|
965
969
|
}
|
|
966
970
|
if (calleeName === 'Convert') {
|
|
@@ -991,10 +995,8 @@ function tpLengthAndConvertCall(env, nd, tgtTy) {
|
|
|
991
995
|
const mockConvertDef = {
|
|
992
996
|
params: paramTys?.map(() => ({ optional: false })) || []
|
|
993
997
|
};
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
env.resolvedCallInfo.set(nd, callInfo);
|
|
997
|
-
}
|
|
998
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(argTys, env.getRawType(nd), mockConvertDef, undefined);
|
|
999
|
+
env.resolvedCallInfo.set(nd, callInfo);
|
|
998
1000
|
return env.getRawType(nd);
|
|
999
1001
|
}
|
|
1000
1002
|
}
|
|
@@ -1020,7 +1022,7 @@ function tpCallInterface(env, nd, tgtTy) {
|
|
|
1020
1022
|
env.setType(nd, finalRetTy);
|
|
1021
1023
|
env.unifier.unify(finalRetTy, tgtTy);
|
|
1022
1024
|
if (!env.isView) {
|
|
1023
|
-
const callInfo = (0, type_manager_1.createFunctionDef)(def.params.map(p => p.typeAnnotation), finalRetTy, def);
|
|
1025
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(def.params.map(p => p.typeAnnotation), finalRetTy, def, undefined);
|
|
1024
1026
|
env.resolvedCallInfo.set(nd, callInfo);
|
|
1025
1027
|
}
|
|
1026
1028
|
return finalRetTy;
|
|
@@ -1035,7 +1037,7 @@ function tpCallConnector(env, nd, tgtTy) {
|
|
|
1035
1037
|
const ndTy = cDef.returns?.[0]?.typeAnnotation;
|
|
1036
1038
|
env.setType(nd, ndTy);
|
|
1037
1039
|
if (!env.isView) {
|
|
1038
|
-
const callInfo = (0, type_manager_1.createFunctionDef)(cDef.params.map(p => p.typeAnnotation), ndTy, cDef);
|
|
1040
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(cDef.params.map(p => p.typeAnnotation), ndTy, cDef, undefined);
|
|
1039
1041
|
env.resolvedCallInfo.set(nd, callInfo);
|
|
1040
1042
|
}
|
|
1041
1043
|
return ndTy;
|
|
@@ -1090,10 +1092,6 @@ function tpSubLogic(env, nd, tgtTy) {
|
|
|
1090
1092
|
env.setType(nd, ndTy);
|
|
1091
1093
|
env.unifier.cs = csCopy;
|
|
1092
1094
|
env.unifier.unify(ndTy, tgtTy); // 这里需要额外的 unify,否则 SubLogic 算出来的类型不能与外侧进来时的约束产生关系
|
|
1093
|
-
if (nd.nodePath?.startsWith('app.logics')) {
|
|
1094
|
-
const postChk = (0, dispatch_def_1.checkVariableAndReturnTypeAnnotations)(nd.variables, nd.returns);
|
|
1095
|
-
env.addPostCheckTask(nd, postChk(env.getCurFileNode(), env.errSeverity));
|
|
1096
|
-
}
|
|
1097
1095
|
return ndTy;
|
|
1098
1096
|
}
|
|
1099
1097
|
function tpArgument(env, nd, tgtTy) {
|
|
@@ -1175,9 +1173,10 @@ function tpCallQueryComponent(env, nd, tgtTy) {
|
|
|
1175
1173
|
const createdVars = createNameAliasVarNodes(aggrAsNames, groupByAsNames);
|
|
1176
1174
|
nd.orderBy && nd.orderBy.forEach(tpOrderByExpr);
|
|
1177
1175
|
nd.having && dispatchExpr(env, nd.having, type_manager_1.naslBooleanTy);
|
|
1178
|
-
nd.havingPlayground && (0, dispatch_stmt_1.tpSolvingPlayground)(env, nd.havingPlayground);
|
|
1179
1176
|
nd.where && dispatchExpr(env, nd.where, type_manager_1.naslBooleanTy);
|
|
1180
|
-
|
|
1177
|
+
// 后置检查连 context 都没了,告辞
|
|
1178
|
+
(0, dispatch_stmt_1.tpSolvingPlayground)(env, nd.wherePlayground);
|
|
1179
|
+
(0, dispatch_stmt_1.tpSolvingPlayground)(env, nd.havingPlayground);
|
|
1181
1180
|
env.ctxTpQFE = undefined;
|
|
1182
1181
|
env.ctxCQC = undefined;
|
|
1183
1182
|
createdVars.forEach(v => {
|
|
@@ -1321,12 +1320,13 @@ function tpCallQueryComponent(env, nd, tgtTy) {
|
|
|
1321
1320
|
? (0, type_manager_1.createAnonymousTyAnn)(['list', 'total'], [(0, type_manager_1.createListTyAnn)(nd.typeAnnotation ?? type_manager_1.naslAnyTy), type_manager_1.naslLongTy])
|
|
1322
1321
|
: (0, type_manager_1.createListTyAnn)(nd.typeAnnotation ?? type_manager_1.naslAnyTy);
|
|
1323
1322
|
}
|
|
1324
|
-
if (nd.ideVersion
|
|
1325
|
-
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1323
|
+
// if (nd.ideVersion !== '2.11' && nd.ideVersion !== '2.22' && nd.typeAnnotation) {
|
|
1324
|
+
// retTy = nd.typeAnnotation; // 那也没办法了,锁死了
|
|
1325
|
+
// } else
|
|
1326
|
+
{
|
|
1328
1327
|
nd.typeAnnotation = retTy;
|
|
1329
1328
|
if (!env.isFirstScreenCheck && !(0, type_predicate_1.isEqualTy)(env, nd.typeAnnotation, retTy)) {
|
|
1329
|
+
// @warning: 这个 typeAnnotation 其实没有用,反正发布的时候会标注上去
|
|
1330
1330
|
nd.update({ typeAnnotation: retTy });
|
|
1331
1331
|
}
|
|
1332
1332
|
}
|
|
@@ -1840,21 +1840,21 @@ function tpEntityLogic(env, nd, tgtTy) {
|
|
|
1840
1840
|
env.unifier.unify(finalRetTy, tgtTy);
|
|
1841
1841
|
// Create a mock definition for entity logics
|
|
1842
1842
|
const mockDef = { params: paramTys.map(() => ({ optional: false })) };
|
|
1843
|
-
const callInfo = (0, type_manager_1.createFunctionDef)(paramTys, finalRetTy, mockDef);
|
|
1843
|
+
const callInfo = (0, type_manager_1.createFunctionDef)(paramTys, finalRetTy, mockDef, undefined);
|
|
1844
1844
|
env.resolvedCallInfo.set(nd, callInfo);
|
|
1845
1845
|
return finalRetTy;
|
|
1846
1846
|
function getRetTy() {
|
|
1847
1847
|
switch (calleeName) {
|
|
1848
1848
|
case 'get': return entityRefTy;
|
|
1849
1849
|
case 'create': return entityOrErrTy; // 带个 Error 类型
|
|
1850
|
-
case 'delete': return type_manager_1.
|
|
1850
|
+
case 'delete': return type_manager_1.naslLongTy; // 现在如此
|
|
1851
1851
|
case 'update': return entityRefTy;
|
|
1852
1852
|
case 'createOrUpdate': return entityOrErrTy; // 带个 Error 类型
|
|
1853
1853
|
case 'updateBy': return type_manager_1.naslLongTy;
|
|
1854
|
-
case 'deleteBy': return type_manager_1.
|
|
1854
|
+
case 'deleteBy': return type_manager_1.naslLongTy;
|
|
1855
1855
|
case 'batchCreate': return listEntityRefTy;
|
|
1856
1856
|
case 'batchUpdate': return listEntityRefTy;
|
|
1857
|
-
case 'batchDelete': return type_manager_1.
|
|
1857
|
+
case 'batchDelete': return type_manager_1.naslLongTy;
|
|
1858
1858
|
case 'import': return type_manager_1.naslStringTy;
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|