Skip to content

Commit f034e50

Browse files
authored
Merge pull request #161 from Arc-huangjingtong/master
Add a new event
2 parents 834db65 + f7f99e4 commit f034e50

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

CodingSeb.ExpressionEvaluator/ExpressionEvaluator.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -928,6 +928,13 @@ public IDictionary<string, object> Variables
928928
}
929929
}
930930

931+
/// <summary>
932+
/// Is fired just before an scriptExpression is evaluate.<para/>
933+
/// Allow to redefine the scriptExpression to evaluate or to force a result value.
934+
/// </summary>
935+
public event EventHandler<ExpressionEvaluationEventArg> ScriptExpressionEvaluating;
936+
937+
931938
/// <summary>
932939
/// Is fired just before an expression is evaluate.<para/>
933940
/// Allow to redefine the expression to evaluate or to force a result value.
@@ -1085,6 +1092,13 @@ public virtual T ScriptEvaluate<T>(string script)
10851092
public virtual object ScriptEvaluate(string script)
10861093
{
10871094
inScript = true;
1095+
1096+
ExpressionEvaluationEventArg expressionEvaluationEventArg = new ExpressionEvaluationEventArg(script, this);
1097+
1098+
ExpressionEvaluating?.Invoke(this, expressionEvaluationEventArg);
1099+
1100+
script = expressionEvaluationEventArg.Expression;
1101+
10881102
try
10891103
{
10901104
bool isReturn = false;

0 commit comments

Comments
 (0)