|
|
|
@ -230,12 +230,16 @@ namespace CSharpBinding
@@ -230,12 +230,16 @@ namespace CSharpBinding
|
|
|
|
|
HighlightedLine line = new HighlightedLine(textEditor.Document, documentLine); |
|
|
|
|
this.line = line; |
|
|
|
|
this.lineNumber = lineNumber; |
|
|
|
|
if (Debugger.IsAttached) { |
|
|
|
|
parseInfo.CompilationUnit.AcceptVisitor(this); |
|
|
|
|
} else { |
|
|
|
|
try { |
|
|
|
|
parseInfo.CompilationUnit.AcceptVisitor(this); |
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
hasCrashed = true; |
|
|
|
|
throw new ApplicationException("Error highlighting line " + lineNumber, ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
this.line = null; |
|
|
|
|
this.resolver = null; |
|
|
|
|
Debug.WriteLine("Semantic highlighting for line {0} - added {1} sections", lineNumber, line.Sections.Count); |
|
|
|
@ -346,13 +350,24 @@ namespace CSharpBinding
@@ -346,13 +350,24 @@ namespace CSharpBinding
|
|
|
|
|
public override void VisitInvocationExpression(InvocationExpression invocationExpression) |
|
|
|
|
{ |
|
|
|
|
Expression target = invocationExpression.Target; |
|
|
|
|
target.AcceptVisitor(this); |
|
|
|
|
|
|
|
|
|
var rr = resolver.Resolve(invocationExpression) as CSharpInvocationResolveResult; |
|
|
|
|
if (rr != null && !rr.IsDelegateInvocation) { |
|
|
|
|
if (target is IdentifierExpression || target is MemberReferenceExpression || target is PointerReferenceExpression) { |
|
|
|
|
Colorize(target.GetChildByRole(Roles.Identifier), methodCallColor); |
|
|
|
|
// apply color to target's target
|
|
|
|
|
target.GetChildByRole(Roles.TargetExpression).AcceptVisitor(this); |
|
|
|
|
|
|
|
|
|
// highlight the method call
|
|
|
|
|
var identifier = target.GetChildByRole(Roles.Identifier); |
|
|
|
|
var invocationRR = resolver.Resolve(invocationExpression) as CSharpInvocationResolveResult; |
|
|
|
|
if (invocationRR != null && !invocationRR.IsDelegateInvocation) { |
|
|
|
|
Colorize(identifier, methodCallColor); |
|
|
|
|
} else { |
|
|
|
|
ResolveResult targetRR = resolver.Resolve(target); |
|
|
|
|
Colorize(identifier, GetColor(targetRR)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach (AstNode node in target.GetChildrenByRole(Roles.TypeArgument)) |
|
|
|
|
node.AcceptVisitor(this); |
|
|
|
|
} else { |
|
|
|
|
target.AcceptVisitor(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
foreach (AstNode node in invocationExpression.Arguments) |
|
|
|
|