[gnome-builder] vala-pack: add synchronous parser for symbol tree



commit 1c91e614f78f070b6d5a7fa2a91f6d8ebae7ce6d
Author: Christian Hergert <chergert redhat com>
Date:   Fri Nov 10 18:40:13 2017 -0800

    vala-pack: add synchronous parser for symbol tree

 src/plugins/vala-pack/ide-vala-index.vala |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/vala-pack/ide-vala-index.vala b/src/plugins/vala-pack/ide-vala-index.vala
index 474b7ca..12af2bc 100644
--- a/src/plugins/vala-pack/ide-vala-index.vala
+++ b/src/plugins/vala-pack/ide-vala-index.vala
@@ -512,6 +512,35 @@ namespace Ide
                        return ret;
                }
 
+               public Ide.SymbolTree? get_symbol_tree_sync (GLib.File file,
+                                                            GLib.Cancellable? cancellable)
+                       throws GLib.Error
+               {
+                       Ide.SymbolTree? ret = null;
+
+                       lock (this.code_context) {
+                               Vala.CodeContext.push (this.code_context);
+
+                               if (!this.source_files.contains (file)) {
+                                       this.add_file (file);
+                                       this.reparse ();
+                               }
+
+                               var source_file = this.source_files [file];
+                               if (source_file.dirty) {
+                                       this.reparse ();
+                               }
+
+                               var tree_builder = new Ide.ValaSymbolTreeVisitor ();
+                               source_file.accept_children (tree_builder);
+                               ret = tree_builder.build_tree ();
+
+                               Vala.CodeContext.pop ();
+                       }
+
+                       return ret;
+               }
+
                string? get_versioned_vapidir ()
                {
                        try {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]