]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Ensure that the CodeContext has no reference to the node before removing it wip/tintou/source-file-remove-code-context
authorCorentin Noël <corentin.noel@collabora.com>
Fri, 15 Mar 2019 14:17:03 +0000 (15:17 +0100)
committerCorentin Noël <corentin.noel@collabora.com>
Fri, 15 Mar 2019 14:20:23 +0000 (15:20 +0100)
vala/valasourcefile.vala

index 35eaf5f266d977c4042c27dffd0e5e3cc85a5208..acaea0d7c444fa899681c10ba4ccad4e2df5481d 100644 (file)
@@ -197,6 +197,13 @@ public class Vala.SourceFile {
        }
 
        public void remove_node (CodeNode node) {
+               // Also update the entry point of the current code context
+               var code_context = CodeContext.get ();
+               unowned Vala.Method? entry_point = code_context.entry_point;
+               if (entry_point != null && entry_point.source_reference == node.source_reference) {
+                       code_context.entry_point = null;
+               }
+
                nodes.remove (node);
        }