[gnome-builder/wip/tintou/vala-subprocess: 77/81] Update to the API changes
- From: Corentin Noël <corentinnoel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/tintou/vala-subprocess: 77/81] Update to the API changes
- Date: Tue, 26 Mar 2019 10:34:05 +0000 (UTC)
commit 51138c72a4e6f148987fdddc7e3cf911c7f85cce
Author: Corentin Noël <corentin noel collabora com>
Date: Mon Mar 11 13:12:29 2019 +0100
Update to the API changes
src/plugins/vala-pack/ide-vala-client.vala | 26 ++++++++++++----------
src/plugins/vala-pack/ide-vala-code-indexer.vala | 2 +-
.../vala-pack/ide-vala-diagnostic-provider.vala | 6 ++++-
src/plugins/vala-pack/ide-vala-service.vala | 3 ++-
.../vala-pack/ide-vala-symbol-resolver.vala | 6 ++---
src/plugins/vala-pack/lang-server/ide-utils.vala | 20 +++++++----------
.../vala-pack/lang-server/ide-vala-index.vala | 8 -------
7 files changed, 33 insertions(+), 38 deletions(-)
---
diff --git a/src/plugins/vala-pack/ide-vala-client.vala b/src/plugins/vala-pack/ide-vala-client.vala
index db5ba1915..c9bf5bf77 100644
--- a/src/plugins/vala-pack/ide-vala-client.vala
+++ b/src/plugins/vala-pack/ide-vala-client.vala
@@ -56,9 +56,21 @@ namespace Ide
//GLib.HashTable<GLib.File, int64?> seq_by_file = null;
State state = State.INITIAL;
- construct {
+ ~ValaClient () {
+ state = State.SHUTDOWN;
+ if (supervisor != null) {
+ var _supervisor = supervisor;
+ supervisor = null;
+ _supervisor.stop ();
+ }
+ }
+
+ public override void parent_set (Ide.Object? parent) {
+ if (parent == null)
+ return;
+
get_client = new GLib.Queue<Ide.Task> ();
- unowned Ide.Context context = get_context ();
+ unowned Ide.Context? context = get_context ();
root_uri = context.ref_workdir ();
var launcher = new Ide.SubprocessLauncher (GLib.SubprocessFlags.STDOUT_PIPE |
GLib.SubprocessFlags.STDIN_PIPE);
@@ -76,15 +88,6 @@ namespace Ide
buffer_manager.buffer_saved.connect (buffer_saved);
}
- ~ValaClient () {
- state = State.SHUTDOWN;
- if (supervisor != null) {
- var _supervisor = supervisor;
- supervisor = null;
- _supervisor.stop ();
- }
- }
-
public void subprocess_exited (Ide.Subprocess object) {
if (state == State.RUNNING)
state = State.SPAWNING;
@@ -445,7 +448,6 @@ namespace Ide
}
}
-
return ret;
} catch (Error e) {
throw e;
diff --git a/src/plugins/vala-pack/ide-vala-code-indexer.vala
b/src/plugins/vala-pack/ide-vala-code-indexer.vala
index b4d3b2cd6..d6898e84e 100644
--- a/src/plugins/vala-pack/ide-vala-code-indexer.vala
+++ b/src/plugins/vala-pack/ide-vala-code-indexer.vala
@@ -36,7 +36,7 @@ namespace Ide
if (!file.is_native ())
throw new GLib.IOError.NOT_SUPPORTED ("Only native files are supported");
- unowned Ide.Context context = this.get_context ();
+ unowned Ide.Context? context = this.get_context ();
unowned Ide.ValaClient client = Ide.ValaClient.from_context (context);
try {
var entries = yield client.index_file_async (file, build_flags, cancellable);
diff --git a/src/plugins/vala-pack/ide-vala-diagnostic-provider.vala
b/src/plugins/vala-pack/ide-vala-diagnostic-provider.vala
index 1e32afd0a..f09e3af48 100644
--- a/src/plugins/vala-pack/ide-vala-diagnostic-provider.vala
+++ b/src/plugins/vala-pack/ide-vala-diagnostic-provider.vala
@@ -40,7 +40,11 @@ namespace Ide
}
unowned Ide.ValaClient client = Ide.ValaClient.from_context (context);
- return yield client.diagnose_async (file, flags, cancellable);
+ try {
+ return yield client.diagnose_async (file, flags, cancellable);
+ } catch (Error e) {
+ throw e;
+ }
}
public void load () {}
diff --git a/src/plugins/vala-pack/ide-vala-service.vala b/src/plugins/vala-pack/ide-vala-service.vala
index eed390cd1..9065d5906 100644
--- a/src/plugins/vala-pack/ide-vala-service.vala
+++ b/src/plugins/vala-pack/ide-vala-service.vala
@@ -41,7 +41,8 @@ namespace Ide
this._index = new Ide.ValaIndex (this.get_context ());
Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
- var workdir = this.ref_context ().ref_workdir ();
+ unowned Ide.Context? context = this.get_context ();
+ var workdir = context.ref_workdir ();
var files = new ArrayList<GLib.File> ();
load_directory (workdir, null, files);
diff --git a/src/plugins/vala-pack/ide-vala-symbol-resolver.vala
b/src/plugins/vala-pack/ide-vala-symbol-resolver.vala
index 0326fd075..2e382455c 100644
--- a/src/plugins/vala-pack/ide-vala-symbol-resolver.vala
+++ b/src/plugins/vala-pack/ide-vala-symbol-resolver.vala
@@ -28,7 +28,7 @@ namespace Ide
GLib.Cancellable? cancellable)
throws GLib.Error
{
- unowned Ide.Context context = this.get_context ();
+ unowned Ide.Context? context = this.get_context ();
unowned Ide.BuildSystem? build_system = Ide.BuildSystem.from_context (context);
string[] flags = {};
@@ -46,7 +46,7 @@ namespace Ide
GLib.Cancellable? cancellable)
throws GLib.Error
{
- unowned Ide.Context context = this.get_context ();
+ unowned Ide.Context? context = this.get_context ();
unowned Ide.BuildSystem? build_system = Ide.BuildSystem.from_context (context);
var line = (int)location.line + 1;
var column = (int)location.line_offset + 1;
@@ -77,7 +77,7 @@ namespace Ide
GLib.Cancellable? cancellable)
throws GLib.Error
{
- unowned Ide.Context context = this.get_context ();
+ unowned Ide.Context? context = this.get_context ();
unowned Ide.BuildSystem? build_system = Ide.BuildSystem.from_context (context);
var line = (int)location.line + 1;
var column = (int)location.line_offset + 1;
diff --git a/src/plugins/vala-pack/lang-server/ide-utils.vala
b/src/plugins/vala-pack/lang-server/ide-utils.vala
index d555f5039..2105cf475 100644
--- a/src/plugins/vala-pack/lang-server/ide-utils.vala
+++ b/src/plugins/vala-pack/lang-server/ide-utils.vala
@@ -2,6 +2,9 @@ namespace Ide {
public static Ide.Symbol? vala_to_ide_symbol (Vala.CodeNode node)
{
Vala.Symbol? symbol = vala_symbol_from_code_node (node);
+ if (symbol == null)
+ return null;
+
Ide.SymbolKind kind = vala_symbol_kind_from_code_node (node);
Ide.SymbolFlags flags = vala_symbol_flags_from_code_node (node);
string name = vala_symbol_name (symbol);
@@ -25,7 +28,7 @@ namespace Ide {
return Ide.SymbolKind.CLASS;
else if (node is Vala.Subroutine) {
Vala.Symbol? symbol = vala_symbol_from_code_node (node);
- if (symbol.is_instance_member ())
+ if (symbol != null && symbol.is_instance_member ())
if (node is Vala.CreationMethod || node is Vala.Constructor) {
return Ide.SymbolKind.CONSTRUCTOR;
} else {
@@ -54,28 +57,21 @@ namespace Ide {
name = (symbol as Vala.CreationMethod).class_name;
}
- if (name == null) {
- critical ("HERE");
- critical ("%s (%s)", symbol.type_name, symbol.get_full_name ());
- critical (symbol.to_string ());
- critical ("~~~~~~~~~~");
- }
-
return name;
}
public static Ide.SymbolFlags vala_symbol_flags_from_code_node (Vala.CodeNode node)
{
Vala.Symbol? symbol = vala_symbol_from_code_node (node);
- var flags = Ide.SymbolFlags.NONE;
- if (symbol.is_instance_member ())
+ Ide.SymbolFlags flags = Ide.SymbolFlags.NONE;
+ if (symbol != null && symbol.is_instance_member ())
flags |= Ide.SymbolFlags.IS_MEMBER;
- var binding = get_member_binding (node);
+ Vala.MemberBinding? binding = get_member_binding (node);
if (binding != null && binding == Vala.MemberBinding.STATIC)
flags |= Ide.SymbolFlags.IS_STATIC;
- if (symbol.version.deprecated)
+ if (symbol != null && symbol.version.deprecated)
flags |= Ide.SymbolFlags.IS_DEPRECATED;
return flags;
diff --git a/src/plugins/vala-pack/lang-server/ide-vala-index.vala
b/src/plugins/vala-pack/lang-server/ide-vala-index.vala
index 85ce065af..150dfd596 100644
--- a/src/plugins/vala-pack/lang-server/ide-vala-index.vala
+++ b/src/plugins/vala-pack/lang-server/ide-vala-index.vala
@@ -77,14 +77,6 @@ namespace Ide
minor = int.parse(tokens[1]);
}
- for (var i = 2; i <= minor; i += 2) {
- code_context.add_define ("VALA_0_%d".printf (i));
- }
-
- for (var i = 16; i < GLib.Version.minor; i+= 2) {
- code_context.add_define ("GLIB_2_%d".printf (i));
- }
-
code_context.vapi_directories = {};
/* $prefix/share/vala-0.32/vapi */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]