优化:移动判断变量值的位置

pull/3078/MERGE
ChenX 4 weeks ago
parent e4f3005a9a
commit 4661d72c8d

@ -88,10 +88,6 @@ export function eval2(expr: string, params?: {}, defaultParam?: string): number
if (typeof result === "bigint") if (typeof result === "bigint")
result = Number(result);//防止bigint乱入 result = Number(result);//防止bigint乱入
if (typeof result !== "number")
throw "计算结果不是实数!";
return result; return result;
} }

@ -173,6 +173,8 @@ export class TemplateParam
try try
{ {
value = eval2(this.expr as string, vardefines); value = eval2(this.expr as string, vardefines);
if (typeof value !== "number")
throw "计算结果不是实数!";
} }
catch (error) catch (error)
{ {

Loading…
Cancel
Save