Skip to content

Commit 8072b6b

Browse files
author
linzhijun
committed
优化代码
1 parent 91ab1c7 commit 8072b6b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

csharp/ToolGood.Algorithm2/Internals/MathVisitor.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3935,7 +3935,7 @@ public virtual Operand VisitGetJsonValue_fun(mathParser.GetJsonValue_funContext
39353935
var obj = firstValue;
39363936
Operand op;
39373937
if (context.parameter2() != null) {
3938-
op = this.Visit(context.parameter2());
3938+
op = context.parameter2().Accept(this);
39393939
} else {
39403940
op = exprs[1].Accept(this);
39413941
if (op.IsError) {
@@ -4016,11 +4016,11 @@ public virtual Operand VisitDiyFunction_fun(mathParser.DiyFunction_funContext co
40164016
public Operand VisitPARAM_fun(mathParser.PARAM_funContext context)
40174017
{
40184018
var exprs = context.expr();
4019-
var args1 = this.Visit(exprs[0]); if (args1.Type != OperandType.TEXT) { args1 = args1.ToText(); if (args1.IsError) return args1; }
4019+
var args1 = exprs[0].Accept(this); if (args1.Type != OperandType.TEXT) { args1 = args1.ToText(); if (args1.IsError) return args1; }
40204020
var result = GetParameter(args1.TextValue);
40214021
if (result.IsError) {
40224022
if (exprs.Length == 2) {
4023-
return this.Visit(exprs[1]);
4023+
return exprs[1].Accept(this);
40244024
}
40254025
}
40264026
return result;
@@ -4029,8 +4029,8 @@ public Operand VisitPARAM_fun(mathParser.PARAM_funContext context)
40294029
public Operand VisitHAS_fun(mathParser.HAS_funContext context)
40304030
{
40314031
var exprs = context.expr();
4032-
var args1 = this.Visit(exprs[0]); if (args1.IsError) { return args1; }
4033-
var args2 = this.Visit(exprs[1]).ToText("Function HAS parameter 2 is error!"); if (args2.IsError) { return args2; }
4032+
var args1 = exprs[0].Accept(this); if (args1.IsError) { return args1; }
4033+
var args2 = exprs[1].Accept(this).ToText("Function HAS parameter 2 is error!"); if (args2.IsError) { return args2; }
40344034

40354035
if (args1.Type == OperandType.ARRARYJSON) {
40364036
return Operand.Create(((OperandKeyValueList)args1).ContainsKey(args2));
@@ -4070,8 +4070,8 @@ public Operand VisitHAS_fun(mathParser.HAS_funContext context)
40704070
public Operand VisitHASVALUE_fun([Antlr4.Runtime.Misc.NotNull] mathParser.HASVALUE_funContext context)
40714071
{
40724072
var exprs = context.expr();
4073-
var args1 = this.Visit(exprs[0]); if (args1.IsError) { return args1; }
4074-
var args2 = this.Visit(exprs[1]).ToText("Function HASVALUE parameter 2 is error!"); if (args2.IsError) { return args2; }
4073+
var args1 = exprs[0].Accept(this); if (args1.IsError) { return args1; }
4074+
var args2 = exprs[1].Accept(this).ToText("Function HASVALUE parameter 2 is error!"); if (args2.IsError) { return args2; }
40754075

40764076
if (args1.Type == OperandType.ARRARYJSON) {
40774077
return Operand.Create(((OperandKeyValueList)args1).ContainsValue(args2));
@@ -4121,7 +4121,7 @@ public Operand VisitArrayJson_fun(mathParser.ArrayJson_funContext context)
41214121
var js = context.arrayJson();
41224122
for (int i = 0; i < js.Length; i++) {
41234123
var item = js[i];
4124-
var aa = this.Visit(item); if (aa.IsError) { return aa; }
4124+
var aa = item.Accept(this); if (aa.IsError) { return aa; }
41254125
result.AddValue((KeyValue)((OperandKeyValue)aa).Value);
41264126
}
41274127
return result;
@@ -4163,14 +4163,14 @@ public Operand VisitArrayJson(mathParser.ArrayJsonContext context)
41634163
if (context.parameter2() != null) {
41644164
keyValue.Key = context.parameter2().GetText();
41654165
}
4166-
keyValue.Value = Visit(context.expr());
4166+
keyValue.Value = context.expr().Accept(this);
41674167
return new OperandKeyValue(keyValue);
41684168
}
41694169

41704170
public Operand VisitERROR_fun(mathParser.ERROR_funContext context)
41714171
{
41724172
if (context.expr() == null) { return Operand.Error(""); }
4173-
var args1 = this.Visit(context.expr()); if (args1.Type != OperandType.TEXT) { args1 = args1.ToText(); if (args1.IsError) return args1; }
4173+
var args1 = context.expr().Accept(this); if (args1.Type != OperandType.TEXT) { args1 = args1.ToText(); if (args1.IsError) return args1; }
41744174
return Operand.Error(args1.TextValue);
41754175
}
41764176

0 commit comments

Comments
 (0)