@@ -929,12 +929,17 @@ public IDictionary<string, object> Variables
929
929
}
930
930
931
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.
932
+ /// Is fired just before a script is evaluate.<para/>
933
+ /// Allow to redefine the script to evaluate or to force a result value.
934
934
/// </summary>
935
- public event EventHandler < ExpressionEvaluationEventArg > ScriptExpressionEvaluating ;
936
-
937
-
935
+ public event EventHandler < ExpressionEvaluationEventArg > ScriptEvaluating ;
936
+
937
+ /// <summary>
938
+ /// Is fired just before to return the script evaluation.<para/>
939
+ /// Allow to modify on the fly the result of the evaluation.
940
+ /// </summary>
941
+ public event EventHandler < ExpressionEvaluationEventArg > ScriptEvaluated ;
942
+
938
943
/// <summary>
939
944
/// Is fired just before an expression is evaluate.<para/>
940
945
/// Allow to redefine the expression to evaluate or to force a result value.
@@ -1095,7 +1100,7 @@ public virtual object ScriptEvaluate(string script)
1095
1100
1096
1101
ExpressionEvaluationEventArg expressionEvaluationEventArg = new ExpressionEvaluationEventArg ( script , this ) ;
1097
1102
1098
- ExpressionEvaluating ? . Invoke ( this , expressionEvaluationEventArg ) ;
1103
+ ScriptEvaluating ? . Invoke ( this , expressionEvaluationEventArg ) ;
1099
1104
1100
1105
script = expressionEvaluationEventArg . Expression ;
1101
1106
@@ -1108,11 +1113,26 @@ public virtual object ScriptEvaluate(string script)
1108
1113
object result = ScriptEvaluate ( script , ref isReturn , ref isBreak , ref isContinue ) ;
1109
1114
1110
1115
if ( isBreak )
1116
+ {
1111
1117
throw new ExpressionEvaluatorSyntaxErrorException ( "[break] keyword executed outside a loop" ) ;
1118
+ }
1112
1119
else if ( isContinue )
1120
+ {
1113
1121
throw new ExpressionEvaluatorSyntaxErrorException ( "[continue] keyword executed outside a loop" ) ;
1122
+ }
1114
1123
else
1124
+ {
1125
+ expressionEvaluationEventArg = new ExpressionEvaluationEventArg ( script , this , result ) ;
1126
+
1127
+ ScriptEvaluated ? . Invoke ( this , expressionEvaluationEventArg ) ;
1128
+
1129
+ if ( expressionEvaluationEventArg . HasValue )
1130
+ {
1131
+ result = expressionEvaluationEventArg . Value ;
1132
+ }
1133
+
1115
1134
return result ;
1135
+ }
1116
1136
}
1117
1137
finally
1118
1138
{
0 commit comments