[mono/monodevelop] d0d58072: [CSharpBinding] Fixed potential System.InvalidOperationException

Mike Krüger ([email protected]) <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141bf862ad1-ffdff83f-7c78-4c86-abdc-e8a6bc33488c-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/monodevelop
  Compare: https://github.com/mono/monodevelop/compare/2676ea464f28...d0d58072caf9

   Commit: d0d58072caf91973a0b94e54956e437820b7185a
   Author: Mike Krüger <[email protected]> (mkrueger)
     Date: 2013-10-16 04:27:07 GMT
      URL: https://github.com/mono/monodevelop/commit/d0d58072caf91973a0b94e54956e437820b7185a

[CSharpBinding] Fixed potential System.InvalidOperationException

Changed paths:
  M main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs

Modified: main/src/addins/CSharpBinding/MonoDevelop.CSharp.Highlighting/CSharpSyntaxMode.cs
===================================================================
@@ -73,9 +73,6 @@ class CSharpSyntaxMode : SyntaxMode, IQuickTaskProvider, IDisposable
 	{
 		readonly Document guiDocument;
 
-		SyntaxTree unit;
-//		CSharpUnresolvedFile parsedFile;
-//		ICompilation compilation;
 		CSharpAstResolver resolver;
 		CancellationTokenSource src;
 
@@ -169,11 +166,9 @@ void HandleDocumentParsed (object sender, EventArgs e)
 							var newResolver = newResolverTask.Result;
 							if (newResolver == null)
 								return;
-							unit = newResolver.RootNode as SyntaxTree;
-//							parsedFile = newResolver.UnresolvedFile;
 							var visitor = new QuickTaskVisitor (newResolver, cancellationToken);
 							try {
-								unit.AcceptVisitor (visitor);
+								newResolver.RootNode.AcceptVisitor (visitor);
 							} catch (Exception ex) {
 								LoggingService.LogError ("Error while analyzing the file for the semantic highlighting.", ex);
 								return;
@@ -695,9 +690,10 @@ protected override void AddRealChunk (Chunk chunk)
 					try {
 						HighlightingVisitior visitor;
 						if (!csharpSyntaxMode.lineSegments.TryGetValue (line, out visitor)) {
-							visitor = new HighlightingVisitior (csharpSyntaxMode.resolver, default (CancellationToken), lineNumber, base.line.Offset, line.Length);
+							var resolver = csharpSyntaxMode.resolver;
+							visitor = new HighlightingVisitior (resolver, default (CancellationToken), lineNumber, base.line.Offset, line.Length);
 							visitor.tree.InstallListener (doc);
-							csharpSyntaxMode.unit.AcceptVisitor (visitor);
+							resolver.RootNode.AcceptVisitor (visitor);
 							csharpSyntaxMode.lineSegments[line] = visitor;
 						}
 						string style;
_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.