diff --git a/Debugger/Debugger.Core/Debugger.Core.csproj b/Debugger/Debugger.Core/Debugger.Core.csproj
index ccf75adbc..fae283544 100644
--- a/Debugger/Debugger.Core/Debugger.Core.csproj
+++ b/Debugger/Debugger.Core/Debugger.Core.csproj
@@ -19,7 +19,7 @@
4096
4
false
- \bin
+ bin\Debug\
True
http://localhost/Debugger.Core/
true
diff --git a/Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs b/Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs
index 260ea86ca..621da0e5f 100644
--- a/Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs
+++ b/Debugger/Debugger.Core/NRefactory/Ast/ExpressionExtensionMethods.cs
@@ -3,6 +3,8 @@
using System;
using System.Collections.Generic;
+using System.IO;
+using System.Linq;
using System.Reflection;
using Debugger;
@@ -149,9 +151,13 @@ namespace ICSharpCode.NRefactory.Ast
public static string PrettyPrint(this AstNode code)
{
if (code == null) return string.Empty;
- CSharpOutputVisitor csOutVisitor = new CSharpOutputVisitor();
- code.AcceptVisitor(csOutVisitor, null);
- return csOutVisitor.Text;
+
+ using (var sw = new StringWriter())
+ {
+ OutputVisitor csOutVisitor = new OutputVisitor(sw, new CSharpFormattingPolicy());
+ code.AcceptVisitor(csOutVisitor, null);
+ return sw.ToString();
+ }
}
public static AstType GetTypeReference(this Type type)
@@ -190,12 +196,21 @@ namespace ICSharpCode.NRefactory.Ast
if (type.DeclaringType != null) {
var outterRef = type.DeclaringType.GetTypeReference();
- var innerRef = new InnerClassTypeReference(outterRef, name, genTypeRefs);
- innerRef.PointerNestingLevel = pointerNest;
- innerRef.RankSpecifier = arrayRanks.ToArray();
+ var innerRef = new ComposedType() {
+ PointerRank = pointerNest,
+ ArraySpecifiers = arrayRanks.ConvertAll(r => new ArraySpecifier(r)),
+ BaseType = new MemberType() {
+ Target = outterRef, MemberName = name, TypeArguments = genTypeRefs }
+ };
+
return innerRef.SetStaticType((DebugType)type);
} else {
- return new TypeReference(name, pointerNest, arrayRanks.ToArray(), genTypeRefs).SetStaticType((DebugType)type);
+ return (new ComposedType() {
+ PointerRank = pointerNest,
+ ArraySpecifiers = arrayRanks.ConvertAll(r => new ArraySpecifier(r)),
+ BaseType = new SimpleType() {
+ Identifier = name,
+ TypeArguments = genTypeRefs }}).SetStaticType((DebugType)type);
}
}
@@ -204,61 +219,75 @@ namespace ICSharpCode.NRefactory.Ast
/// Dotted names are split into separate nodes.
/// It does not normalize generic arguments.
///
- static SimpleType NormalizeTypeReference(this AstNode expr)
+ static AstType NormalizeTypeReference(this AstNode expr)
{
if (expr is IdentifierExpression) {
- return new SimpleType() {
+ return new SimpleType() {
Identifier = ((IdentifierExpression)expr).Identifier,
TypeArguments = ((IdentifierExpression)expr).TypeArguments};
} else if (expr is MemberReferenceExpression) {
var outter = NormalizeTypeReference(((MemberReferenceExpression)expr).Target);
- return new InnerClassTypeReference(
- outter,
- ((MemberReferenceExpression)expr).MemberName,
- ((MemberReferenceExpression)expr).TypeArguments
- );
+ return new MemberType() { Target = outter,
+ MemberName = ((MemberReferenceExpression)expr).MemberName,
+ TypeArguments = ((MemberReferenceExpression)expr).TypeArguments };
} else if (expr is TypeReferenceExpression) {
- return NormalizeTypeReference(((TypeReferenceExpression)expr).TypeReference);
- } else if (expr is InnerClassTypeReference) { // Frist - it is also TypeReference
- InnerClassTypeReference typeRef = (InnerClassTypeReference)expr;
- string[] names = typeRef.Type.Split('.');
- var newRef = NormalizeTypeReference(typeRef.BaseType);
- foreach(string name in names) {
- newRef = new InnerClassTypeReference(newRef, name, new List());
- }
- newRef.GenericTypes.AddRange(typeRef.GenericTypes);
- newRef.PointerNestingLevel = typeRef.PointerNestingLevel;
- newRef.RankSpecifier = typeRef.RankSpecifier;
- return newRef;
- } else if (expr is TypeReference) {
- var typeRef = (TypeReference)expr;
- string[] names = typeRef.Type.Split('.');
- if (names.Length == 1)
- return typeRef;
- TypeReference newRef = null;
+ return NormalizeTypeReference(((TypeReferenceExpression)expr).Type);
+ } else if (expr is ComposedType) { // Frist - it is also TypeReference
+ var typeRef = (ComposedType)expr;
+ string[] names = null;
+ if (typeRef.BaseType is SimpleType)
+ names = (((SimpleType)typeRef.BaseType)).Identifier.Split('.');
+ else
+ names = (((MemberType)typeRef.BaseType)).MemberName.Split('.');
+
+ var newRef = NormalizeTypeReference(typeRef.BaseType) as ComposedType;
foreach(string name in names) {
- if (newRef == null) {
- newRef = new TypeReference(name, new List());
- } else {
- newRef = new TypeReference(newRef, name, new List());
- }
+ newRef = new ComposedType() {
+ BaseType = new SimpleType() { Identifier = name, TypeArguments = new List() }
+ };
}
- newRef.GenericTypes.AddRange(typeRef.GenericTypes);
- newRef.PointerNestingLevel = typeRef.PointerNestingLevel;
- newRef.RankSpecifier = typeRef.RankSpecifier;
+ //(((MemberType)newRef).TypeArguments as List).AddRange(typeRef.TypeArguments);
+ newRef.PointerRank = typeRef.PointerRank;
+ newRef.ArraySpecifiers = typeRef.ArraySpecifiers;
return newRef;
- } else {
+ }
+// else if (expr is SimpleType) {
+// var typeRef = (SimpleType)expr;
+// string[] names = typeRef.Identifier.Split('.');
+// if (names.Length == 1)
+// return typeRef;
+// SimpleType newRef = null;
+// foreach(string name in names) {
+// if (newRef == null) {
+// newRef = new SimpleType() { Identifier = name, TypeArguments = new List() };
+// } else {
+// newRef = new MemberType() { Target = newRef, MemberName = name, TypeArguments = new List() };
+// }
+// }
+// ((List)newRef.TypeArguments).AddRange(typeRef.TypeArguments);
+// newRef.PointerNestingLevel = typeRef.PointerNestingLevel;
+// newRef.RankSpecifier = typeRef.RankSpecifier;
+// return newRef;
+// }
+ else {
throw new EvaluateException(expr, "Type expected. {0} seen.", expr.GetType().FullName);
}
}
- static string GetNameWithArgCounts(SimpleType typeRef)
+ static string GetNameWithArgCounts(AstType typeRef)
{
- string name = typeRef.Type;
- if (typeRef.GenericTypes.Count > 0)
- name += "`" + typeRef.GenericTypes.Count.ToString();
- if (typeRef is InnerClassTypeReference) {
- return GetNameWithArgCounts(((InnerClassTypeReference)typeRef).BaseType) + "." + name;
+ string name = string.Empty;
+
+ if (typeRef is SimpleType)
+ {
+ name = ((SimpleType)typeRef).Identifier;
+ if (((SimpleType)typeRef).TypeArguments.Count() > 0)
+ name += "`" + ((SimpleType)typeRef).TypeArguments.Count().ToString();
+ }
+
+ if (typeRef is MemberType) {
+ name = ((MemberType)typeRef).MemberName;
+ return GetNameWithArgCounts(((MemberType)typeRef).Target) + "." + name;
} else {
return name;
}
@@ -266,24 +295,26 @@ namespace ICSharpCode.NRefactory.Ast
public static DebugType ResolveType(this AstNode expr, Debugger.AppDomain appDomain)
{
- if (expr is TypeReference && expr.GetStaticType() != null)
+ if (expr is AstType && expr.GetStaticType() != null)
return expr.GetStaticType();
- if (expr is TypeReferenceExpression && ((TypeReferenceExpression)expr).TypeReference.GetStaticType() != null)
- return ((TypeReferenceExpression)expr).TypeReference.GetStaticType();
+ if (expr is TypeReferenceExpression && ((TypeReferenceExpression)expr).Type.GetStaticType() != null)
+ return ((TypeReferenceExpression)expr).Type.GetStaticType();
appDomain.Process.TraceMessage("Resolving {0}", expr.PrettyPrint());
- TypeReference typeRef = NormalizeTypeReference(expr);
+ var typeRef = NormalizeTypeReference(expr);
- List genTypeRefs;
- if (typeRef is InnerClassTypeReference) {
- genTypeRefs = ((InnerClassTypeReference)typeRef).CombineToNormalTypeReference().GenericTypes;
+ List genTypeRefs = null;
+ if (typeRef is MemberType) {
+ //FIXME genTypeRefs = ((MemberType)typeRef).CombineToNormalTypeReference().TypeArguments as List;
} else {
- genTypeRefs = typeRef.GenericTypes;
+ if (typeRef is SimpleType) {
+ genTypeRefs = ((SimpleType)typeRef).TypeArguments as List;
+ }
}
List genArgs = new List();
- foreach(TypeReference genTypeRef in genTypeRefs) {
+ foreach(var genTypeRef in genTypeRefs) {
genArgs.Add(ResolveType(genTypeRef, appDomain));
}
@@ -294,37 +325,46 @@ namespace ICSharpCode.NRefactory.Ast
/// For performance this is separate method.
/// 'genArgs' should hold type for each generic parameter in 'typeRef'.
///
- static DebugType ResolveTypeInternal(SimpleType typeRef, DebugType[] genArgs, Debugger.AppDomain appDomain)
+ static DebugType ResolveTypeInternal(AstType typeRef, DebugType[] genArgs, Debugger.AppDomain appDomain)
{
DebugType type = null;
- // Try to construct non-nested type
- // If there are generic types up in the tree, it must be nested type
- if (genArgs.Length == typeRef.GenericTypes.Count) {
- string name = GetNameWithArgCounts(typeRef);
- type = DebugType.CreateFromNameOrNull(appDomain, name, null, genArgs);
+ if (typeRef is SimpleType) {
+ // Try to construct non-nested type
+ // If there are generic types up in the tree, it must be nested type
+ var simple = (SimpleType)typeRef;
+
+ if (genArgs.Length == simple.TypeArguments.Count()) {
+ string name = GetNameWithArgCounts(simple);
+ type = DebugType.CreateFromNameOrNull(appDomain, name, null, genArgs);
+ }
}
-
// Try to construct nested type
- if (type == null && typeRef is InnerClassTypeReference) {
+ if (type == null && typeRef is MemberType) {
+ var member = (MemberType)typeRef;
DebugType[] outterGenArgs = genArgs;
// Do not pass our generic arguments to outter type
- Array.Resize(ref outterGenArgs, genArgs.Length - typeRef.GenericTypes.Count);
+ Array.Resize(ref outterGenArgs, genArgs.Length - member.TypeArguments.Count());
- DebugType outter = ResolveTypeInternal(((InnerClassTypeReference)typeRef).BaseType, outterGenArgs, appDomain);
- string nestedName = typeRef.GenericTypes.Count == 0 ? typeRef.Type : typeRef.Type + "`" + typeRef.GenericTypes.Count;
+ DebugType outter = ResolveTypeInternal(member.Target, outterGenArgs, appDomain);
+ string nestedName = member.TypeArguments.Count() == 0 ?
+ member.MemberName : member.MemberName + "`" + member.TypeArguments.Count();
type = DebugType.CreateFromNameOrNull(appDomain, nestedName, outter, genArgs);
}
if (type == null)
throw new GetValueException("Can not resolve " + typeRef.PrettyPrint());
- for(int i = 0; i < typeRef.PointerNestingLevel; i++) {
- type = (DebugType)type.MakePointerType();
- }
- if (typeRef.RankSpecifier != null) {
- for(int i = typeRef.RankSpecifier.Length - 1; i >= 0; i--) {
- type = (DebugType)type.MakeArrayType(typeRef.RankSpecifier[i] + 1);
+ if (typeRef is ComposedType) {
+
+ for(int i = 0; i < ((ComposedType)typeRef).PointerRank; i++) {
+ type = (DebugType)type.MakePointerType();
+ }
+ if (((ComposedType)typeRef).ArraySpecifiers != null) {
+ var enumerator = ((ComposedType)typeRef).ArraySpecifiers.Reverse().GetEnumerator();
+ while (enumerator.MoveNext()) {
+ type = (DebugType)type.MakeArrayType(enumerator.Current.Dimensions + 1);
+ }
}
}
return type;
diff --git a/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs b/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs
index 26c21042d..0799f17d9 100644
--- a/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs
+++ b/Debugger/Debugger.Core/NRefactory/Visitors/ExpressionEvaluator.cs
@@ -4,6 +4,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
@@ -60,15 +61,21 @@ namespace ICSharpCode.NRefactory.Visitors
public static AstNode Parse(string code, SupportedLanguage language)
{
- SnippetParser parser = new SnippetParser(language);
- AstNode astRoot = parser.Parse(code);
- if (parser.Errors.Count > 0) {
- throw new GetValueException(parser.Errors.ErrorOutput);
- }
- if (parser.SnippetType != SnippetType.Expression && parser.SnippetType != SnippetType.Statements) {
- throw new GetValueException("Code must be expression or statement");
+ switch (language) {
+ case SupportedLanguage.CSharp:
+ var parser = new CSharpParser();
+ using (var textReader = new StringReader(code)) {
+ AstNode astRoot = parser.ParseExpression(textReader);
+ if (parser.HasErrors) {
+ throw new GetValueException("Parser errors");
+ }
+
+ return astRoot;
+ }
+ break;
+ default:
+ throw new ArgumentException("Unsuported language");
}
- return astRoot;
}
/// Evaluate given expression. If you have expression tree already, use overloads of this method.
@@ -106,16 +113,20 @@ namespace ICSharpCode.NRefactory.Visitors
///
public static Expression ParseExpression(string code, SupportedLanguage language)
{
- SnippetParser parser = new SnippetParser(language);
- AstNode astRoot = parser.Parse(code);
- if (parser.Errors.Count > 0) {
- throw new GetValueException(parser.Errors.ErrorOutput);
- }
- Expression astExpression = astRoot as Expression;
- if (astExpression == null) {
- throw new GetValueException("Code must be expression");
+ switch (language) {
+ case SupportedLanguage.CSharp:
+ var parser = new CSharpParser();
+ using (var textReader = new StringReader(code)) {
+ AstNode astRoot = parser.ParseExpression(textReader);
+ if (parser.HasErrors) {
+ throw new GetValueException("Parser errors");
+ }
+
+ return astRoot as Expression;
+ }
+ default:
+ throw new ArgumentException("Unsuported language");
}
- return astExpression;
}
public static string FormatValue(Value val)
@@ -279,21 +290,17 @@ namespace ICSharpCode.NRefactory.Visitors
{
BinaryOperatorType op;
switch (assignmentExpression.Operator) {
- //case AssignmentOperatorType.Assign: op = BinaryOperatorType.None; break;
- case AssignmentOperatorType.Add: op = BinaryOperatorType.Add; break;
- //case AssignmentOperatorType.ConcatString: op = BinaryOperatorType.Concat; break;
- case AssignmentOperatorType.Subtract: op = BinaryOperatorType.Subtract; break;
- case AssignmentOperatorType.Multiply: op = BinaryOperatorType.Multiply; break;
- case AssignmentOperatorType.Divide: op = BinaryOperatorType.Divide; break;
- //case AssignmentOperatorType.DivideInteger: op = BinaryOperatorType.DivideInteger; break;
- case AssignmentOperatorType.ShiftLeft: op = BinaryOperatorType.ShiftLeft; break;
- case AssignmentOperatorType.ShiftRight: op = BinaryOperatorType.ShiftRight; break;
- case AssignmentOperatorType.ExclusiveOr: op = BinaryOperatorType.ExclusiveOr; break;
- case AssignmentOperatorType.Modulus: op = BinaryOperatorType.Modulus; break;
- case AssignmentOperatorType.BitwiseAnd: op = BinaryOperatorType.BitwiseAnd; break;
- case AssignmentOperatorType.BitwiseOr: op = BinaryOperatorType.BitwiseOr; break;
- //case AssignmentOperatorType.Power: op = BinaryOperatorType.Power; break;
- default: throw new GetValueException("Unknown operator " + assignmentExpression.Operator);
+ case AssignmentOperatorType.Add: op = BinaryOperatorType.Add; break;
+ case AssignmentOperatorType.Subtract: op = BinaryOperatorType.Subtract; break;
+ case AssignmentOperatorType.Multiply: op = BinaryOperatorType.Multiply; break;
+ case AssignmentOperatorType.Divide: op = BinaryOperatorType.Divide; break;
+ case AssignmentOperatorType.ShiftLeft: op = BinaryOperatorType.ShiftLeft; break;
+ case AssignmentOperatorType.ShiftRight: op = BinaryOperatorType.ShiftRight; break;
+ case AssignmentOperatorType.ExclusiveOr: op = BinaryOperatorType.ExclusiveOr; break;
+ case AssignmentOperatorType.Modulus: op = BinaryOperatorType.Modulus; break;
+ case AssignmentOperatorType.BitwiseAnd: op = BinaryOperatorType.BitwiseAnd; break;
+ case AssignmentOperatorType.BitwiseOr: op = BinaryOperatorType.BitwiseOr; break;
+ default: throw new GetValueException("Unknown operator " + assignmentExpression.Operator);
}
TypedValue right;
@@ -343,7 +350,7 @@ namespace ICSharpCode.NRefactory.Visitors
public object VisitCastExpression(CastExpression castExpression, object data)
{
TypedValue val = Evaluate(castExpression.Expression);
- DebugType castTo = castExpression.ResolveType(context.AppDomain).CastTo();
+ DebugType castTo = null;// FIXME castExpression.CastTo().ResolveType(context.AppDomain);
if (castTo.IsPrimitive && val.Type.IsPrimitive && castTo != val.Type) {
object oldVal = val.PrimitiveValue;
object newVal;
@@ -491,10 +498,10 @@ namespace ICSharpCode.NRefactory.Visitors
public object VisitArrayCreateExpression(ArrayCreateExpression arrayCreateExpression, object data)
{
- if (arrayCreateExpression.Initializer.RankSpecifier[0] != 0)
+ if (arrayCreateExpression.AdditionalArraySpecifiers.Count() != 0)
throw new EvaluateException(arrayCreateExpression, "Multi-dimensional arrays are not suppored");
- DebugType type = arrayCreateExpression.CreateType.ResolveType(context.AppDomain);
+ DebugType type = arrayCreateExpression.Type.ResolveType(context.AppDomain);
int length = 0;
if (arrayCreateExpression.Arguments.Count() == 1) {
length = EvaluateAsInt(arrayCreateExpression.Arguments.First());
@@ -592,9 +599,9 @@ namespace ICSharpCode.NRefactory.Visitors
TypedValue newValue = null;
try {
if (op == UnaryOperatorType.Decrement || op == UnaryOperatorType.PostDecrement)
- newValue = (TypedValue)VisitAssignmentExpression(new AssignmentExpression(unaryOperatorExpression.Expression, AssignmentOperatorType.Subtract), null);
+ newValue = (TypedValue)VisitAssignmentExpression(new AssignmentExpression() { Right = unaryOperatorExpression.Expression, Operator = AssignmentOperatorType.Subtract }, null);
if (op == UnaryOperatorType.Increment || op == UnaryOperatorType.PostIncrement)
- newValue = (TypedValue)VisitAssignmentExpression(new AssignmentExpression(unaryOperatorExpression.Expression, AssignmentOperatorType.Add), null);
+ newValue = (TypedValue)VisitAssignmentExpression(new AssignmentExpression(){ Right = unaryOperatorExpression.Expression, Operator = AssignmentOperatorType.Add }, null);
} catch (EvaluateException e) {
throw new EvaluateException(unaryOperatorExpression, e.Message);
}
@@ -644,7 +651,7 @@ namespace ICSharpCode.NRefactory.Visitors
}
}
}
-
+
throw new EvaluateException(unaryOperatorExpression, "Can not use the unary operator {0} on type {1}", op.ToString(), value.Type.FullName);
}
@@ -658,57 +665,57 @@ namespace ICSharpCode.NRefactory.Visitors
if (argType == typeof(bool)) {
bool a = (bool)val;
switch (op) {
- case UnaryOperatorType.Not: return !a;
+ case UnaryOperatorType.Not: return !a;
}
}
if (argType == typeof(float)) {
float a = (float)val;
switch (op) {
- case UnaryOperatorType.Minus: return -a;
- case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.Minus: return -a;
+ case UnaryOperatorType.Plus: return +a;
}
}
if (argType == typeof(double)) {
double a = (double)val;
switch (op) {
- case UnaryOperatorType.Minus: return -a;
- case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.Minus: return -a;
+ case UnaryOperatorType.Plus: return +a;
}
}
-
+
if (argType == typeof(int)) {
int a = (int)val;
switch (op) {
- case UnaryOperatorType.Minus: return -a;
- case UnaryOperatorType.Plus: return +a;
- case UnaryOperatorType.BitNot: return ~a;
+ case UnaryOperatorType.Minus: return -a;
+ case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.BitNot: return ~a;
}
}
if (argType == typeof(uint)) {
uint a = (uint)val;
switch (op) {
- case UnaryOperatorType.Plus: return +a;
- case UnaryOperatorType.BitNot: return ~a;
+ case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.BitNot: return ~a;
}
}
if (argType == typeof(long)) {
long a = (long)val;
switch (op) {
- case UnaryOperatorType.Minus: return -a;
- case UnaryOperatorType.Plus: return +a;
- case UnaryOperatorType.BitNot: return ~a;
+ case UnaryOperatorType.Minus: return -a;
+ case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.BitNot: return ~a;
}
}
if (argType == typeof(ulong)) {
ulong a = (ulong)val;
switch (op) {
- case UnaryOperatorType.Plus: return +a;
- case UnaryOperatorType.BitNot: return ~a;
+ case UnaryOperatorType.Plus: return +a;
+ case UnaryOperatorType.BitNot: return ~a;
}
}
}
@@ -793,8 +800,8 @@ namespace ICSharpCode.NRefactory.Visitors
// void operator +(ulong x, long y);
// float operator +(float x, float y);
// double operator +(double x, double y);
- //
- // &, |, ^, &&, ||
+ //
+ // &, |, ^, &&, ||
// ==, !=
// bool operator &(bool x, bool y);
@@ -838,9 +845,9 @@ namespace ICSharpCode.NRefactory.Visitors
string a = (string)left;
string b = (string)right;
switch (op) {
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.Add: return a + b;
}
}
@@ -848,13 +855,13 @@ namespace ICSharpCode.NRefactory.Visitors
bool a = (bool)left;
bool b = (bool)right;
switch (op) {
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.ExclusiveOr: return a ^ b;
- case BinaryOperatorType.BitwiseAnd: return a & b;
- case BinaryOperatorType.BitwiseOr: return a | b;
- case BinaryOperatorType.ConditionalAnd: return a && b;
- case BinaryOperatorType.ConditionalOr: return a || b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.ExclusiveOr: return a ^ b;
+ case BinaryOperatorType.BitwiseAnd: return a & b;
+ case BinaryOperatorType.BitwiseOr: return a | b;
+ case BinaryOperatorType.ConditionalAnd: return a && b;
+ case BinaryOperatorType.ConditionalOr: return a || b;
}
}
@@ -862,18 +869,18 @@ namespace ICSharpCode.NRefactory.Visitors
float a = (float)left;
float b = (float)right;
switch (op) {
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
@@ -881,129 +888,129 @@ namespace ICSharpCode.NRefactory.Visitors
double a = (double)left;
double b = (double)right;
switch (op) {
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
if (argTypes == typeof(int)) {
switch (op) {
- case BinaryOperatorType.ShiftLeft: return (int)left << (int)right;
- case BinaryOperatorType.ShiftRight: return (int)left >> (int)right;
+ case BinaryOperatorType.ShiftLeft: return (int)left << (int)right;
+ case BinaryOperatorType.ShiftRight: return (int)left >> (int)right;
}
int a = (int)left;
int b = (int)right;
switch (op) {
- case BinaryOperatorType.BitwiseAnd: return a & b;
- case BinaryOperatorType.BitwiseOr: return a | b;
- case BinaryOperatorType.ExclusiveOr: return a ^ b;
-
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.BitwiseAnd: return a & b;
+ case BinaryOperatorType.BitwiseOr: return a | b;
+ case BinaryOperatorType.ExclusiveOr: return a ^ b;
+
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
if (argTypes == typeof(uint)) {
switch (op) {
- case BinaryOperatorType.ShiftLeft: return (uint)left << (int)right;
- case BinaryOperatorType.ShiftRight: return (uint)left >> (int)right;
+ case BinaryOperatorType.ShiftLeft: return (uint)left << (int)right;
+ case BinaryOperatorType.ShiftRight: return (uint)left >> (int)right;
}
uint a = (uint)left;
uint b = (uint)right;
switch (op) {
- case BinaryOperatorType.BitwiseAnd: return a & b;
- case BinaryOperatorType.BitwiseOr: return a | b;
- case BinaryOperatorType.ExclusiveOr: return a ^ b;
-
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.BitwiseAnd: return a & b;
+ case BinaryOperatorType.BitwiseOr: return a | b;
+ case BinaryOperatorType.ExclusiveOr: return a ^ b;
+
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
if (argTypes == typeof(long)) {
switch (op) {
- case BinaryOperatorType.ShiftLeft: return (long)left << (int)right;
- case BinaryOperatorType.ShiftRight: return (long)left >> (int)right;
+ case BinaryOperatorType.ShiftLeft: return (long)left << (int)right;
+ case BinaryOperatorType.ShiftRight: return (long)left >> (int)right;
}
long a = (long)left;
long b = (long)right;
switch (op) {
- case BinaryOperatorType.BitwiseAnd: return a & b;
- case BinaryOperatorType.BitwiseOr: return a | b;
- case BinaryOperatorType.ExclusiveOr: return a ^ b;
-
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.BitwiseAnd: return a & b;
+ case BinaryOperatorType.BitwiseOr: return a | b;
+ case BinaryOperatorType.ExclusiveOr: return a ^ b;
+
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
if (argTypes == typeof(ulong)) {
switch (op) {
- case BinaryOperatorType.ShiftLeft: return (ulong)left << (int)right;
- case BinaryOperatorType.ShiftRight: return (ulong)left >> (int)right;
+ case BinaryOperatorType.ShiftLeft: return (ulong)left << (int)right;
+ case BinaryOperatorType.ShiftRight: return (ulong)left >> (int)right;
}
ulong a = (ulong)left;
ulong b = (ulong)right;
switch (op) {
- case BinaryOperatorType.BitwiseAnd: return a & b;
- case BinaryOperatorType.BitwiseOr: return a | b;
- case BinaryOperatorType.ExclusiveOr: return a ^ b;
-
- case BinaryOperatorType.GreaterThan: return a > b;
- case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
- case BinaryOperatorType.Equality: return a == b;
- case BinaryOperatorType.InEquality: return a != b;
- case BinaryOperatorType.LessThan: return a < b;
- case BinaryOperatorType.LessThanOrEqual: return a <= b;
-
- case BinaryOperatorType.Add: return a + b;
- case BinaryOperatorType.Subtract: return a - b;
- case BinaryOperatorType.Multiply: return a * b;
- case BinaryOperatorType.Divide: return a / b;
- case BinaryOperatorType.Modulus: return a % b;
+ case BinaryOperatorType.BitwiseAnd: return a & b;
+ case BinaryOperatorType.BitwiseOr: return a | b;
+ case BinaryOperatorType.ExclusiveOr: return a ^ b;
+
+ case BinaryOperatorType.GreaterThan: return a > b;
+ case BinaryOperatorType.GreaterThanOrEqual: return a >= b;
+ case BinaryOperatorType.Equality: return a == b;
+ case BinaryOperatorType.InEquality: return a != b;
+ case BinaryOperatorType.LessThan: return a < b;
+ case BinaryOperatorType.LessThanOrEqual: return a <= b;
+
+ case BinaryOperatorType.Add: return a + b;
+ case BinaryOperatorType.Subtract: return a - b;
+ case BinaryOperatorType.Multiply: return a * b;
+ case BinaryOperatorType.Divide: return a / b;
+ case BinaryOperatorType.Modulus: return a % b;
}
}
-
+
return null;
}
}
diff --git a/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs b/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs
index d790ad0ec..736e5c76e 100644
--- a/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs
+++ b/Debugger/ILSpy.Debugger/AvalonEdit/IconBarMargin.cs
@@ -25,6 +25,7 @@ using System.Windows.Media;
using ICSharpCode.AvalonEdit.Editing;
using ICSharpCode.AvalonEdit.Rendering;
using ICSharpCode.AvalonEdit.Utils;
+using ICSharpCode.Decompiler.Disassembler;
using ILSpy.Debugger.Bookmarks;
using ILSpy.Debugger.Services;
using Mono.Cecil;
diff --git a/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs b/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
index 0ac19cdab..747edfa11 100644
--- a/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
+++ b/Debugger/ILSpy.Debugger/Bookmarks/BookmarkManager.cs
@@ -119,7 +119,7 @@ namespace ILSpy.Debugger.Bookmarks
}
}
// no bookmark at that line: create a new bookmark
- BookmarkManager.AddMark(bookmarkFactory(new AstLocation(0, line)));
+ BookmarkManager.AddMark(bookmarkFactory(new AstLocation(line, 0)));
}
public static event BookmarkEventHandler Removed;
diff --git a/Debugger/ILSpy.Debugger/Models/TreeModel/ChildNodesOfObject.cs b/Debugger/ILSpy.Debugger/Models/TreeModel/ChildNodesOfObject.cs
index 5156d36d3..effb7c7ab 100644
--- a/Debugger/ILSpy.Debugger/Models/TreeModel/ChildNodesOfObject.cs
+++ b/Debugger/ILSpy.Debugger/Models/TreeModel/ChildNodesOfObject.cs
@@ -97,11 +97,7 @@ namespace ILSpy.Debugger.Models.TreeModel
public static IEnumerable LazyGetItemsOfIList(Expression targetObject)
{
// This is needed for expanding IEnumerable
- targetObject = new CastExpression(
- new TypeReference(typeof(IList).FullName),
- targetObject,
- CastType.Cast
- );
+ targetObject = new CastExpression() { Expression = targetObject, Type = new SimpleType() { Identifier = typeof(IList).FullName } };
int count = 0;
GetValueException error = null;
try {
diff --git a/Debugger/ILSpy.Debugger/Models/TreeModel/StackFrameNode.cs b/Debugger/ILSpy.Debugger/Models/TreeModel/StackFrameNode.cs
index 3c74db041..547d8db44 100644
--- a/Debugger/ILSpy.Debugger/Models/TreeModel/StackFrameNode.cs
+++ b/Debugger/ILSpy.Debugger/Models/TreeModel/StackFrameNode.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using Debugger;
using Debugger.MetaData;
using ICSharpCode.NRefactory.Ast;
+using ICSharpCode.NRefactory.CSharp;
namespace ILSpy.Debugger.Models.TreeModel
{
diff --git a/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs b/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs
index 1c3a9915b..1701df800 100644
--- a/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs
+++ b/Debugger/ILSpy.Debugger/Services/Debugger/DebuggerHelper.cs
@@ -27,8 +27,8 @@ namespace ILSpy.Debugger.Services.Debugger
listType = DebugType.CreateFromType(itemType.AppDomain, typeof(System.Collections.Generic.List<>), itemType);
var iEnumerableType = DebugType.CreateFromType(itemType.AppDomain, typeof(IEnumerable<>), itemType);
// explicitely cast the variable to IEnumerable, where T is itemType
- Expression iEnumerableVariableExplicitCast = new CastExpression(iEnumerableType.GetTypeReference() , iEnumerableVariable, CastType.Cast);
- return new ObjectCreateExpression(listType.GetTypeReference(), iEnumerableVariableExplicitCast.ToList());
+ Expression iEnumerableVariableExplicitCast = new CastExpression { Expression = iEnumerableVariable , Type = iEnumerableType.GetTypeReference() };
+ return new ObjectCreateExpression() { Type = listType.GetTypeReference(), Arguments = iEnumerableVariableExplicitCast.ToList() };
}
///
diff --git a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs
index 98a7a033f..fcaa9d36c 100644
--- a/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs
+++ b/NRefactory/ICSharpCode.NRefactory/CSharp/Ast/Expressions/BinaryOperatorExpression.cs
@@ -167,6 +167,8 @@ namespace ICSharpCode.NRefactory.CSharp
ShiftRight,
/// left ?? right
- NullCoalescing
+ NullCoalescing,
+
+ None
}
}