private object EvaluateUnaryOperatorExpression(UnaryOperatorExpression unaryOperatorExpression, CodeContext context)
{
ExpressionParseType referenceOrValue;
var operatorType = unaryOperatorExpression.Operator;
if(operatorType == UnaryOperatorType.PostDecrement ||
operatorType == UnaryOperatorType.PostIncrement ||
operatorType == UnaryOperatorType.Decrement ||
operatorType == UnaryOperatorType.Increment)
{
referenceOrValue = ExpressionParseType.GetReference;
}
else
{
referenceOrValue = ExpressionParseType.Evaluate;
}
// We need to get referene so that the
object value = EvaluateExpression(unaryOperatorExpression.Expression, context, referenceOrValue);
if (value == null)
{
return value;
}
else
{
return PrimitiveOperationManager.Self.ApplyUnaryOperation(unaryOperatorExpression.Operator, value, referenceOrValue);
}
}