public void Visit(UnaryExpression expression) { throw new NotImplementedException(); }
public void Visit(UnaryExpression expression) { if (expression == null) { throw new ArgumentNullException("expression"); } expression.Expression.Accept(this); if (result is int) { int param = (int)result; switch (expression.Type) { case UnaryExpressionType.Not: result = param != 0 ? 0 : 1; break; case UnaryExpressionType.BitNot: result = ~param; break; case UnaryExpressionType.Positive: result = +param; break; case UnaryExpressionType.Negative: result = -param; break; case UnaryExpressionType.Dereference: int value; int pointerValue; if (param == 1 || param == 0) { ValueExtractor ve = new ValueExtractor(); expression.Expression.Accept(ve); string expr = ve.Expression; if (context.TryResolveDereference(expr, out value, out pointerValue)) { result = value; } } else { IntPtr p = new IntPtr(param); result = System.Runtime.InteropServices.Marshal.ReadIntPtr(p).ToInt32(); } break; default: break; } } else if (result is string) { result = GetUnaryOperatorString(expression.Type) + result.ToString(); } }