[gnome-builder] vala: work around Vala language breaks
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] vala: work around Vala language breaks
- Date: Sat, 11 Mar 2017 02:57:23 +0000 (UTC)
commit edc8381c1fe2f904f5dce10f74876cb100fe42e9
Author: Christian Hergert <chergert redhat com>
Date: Fri Mar 10 13:54:35 2017 -0800
vala: work around Vala language breaks
Commit e874bb7902cc06f9f6d4427d99ec33e3757304e4 broke a bunch of
inheritance in vala (that wasn't very good to begin with, but at least it
worked). In particular, Vala has a very hard time determining if an object
properly meets the interface requirements. It does not handle relaxed
write checks vs the parent very well (and has strange requirements for
vfuncs to be available that are completely unnecessary).
However, we can stop inheriting from Ide.Object and implement the context
property ourselves to work around the issue. Incredibly annoying, but good
enough to fix the build a week before release.
.../vala-pack/ide-vala-completion-provider.vala | 13 ++++++++++---
.../vala-pack/ide-vala-diagnostic-provider.vala | 14 ++++++++++----
plugins/vala-pack/ide-vala-indenter.vala | 9 ++++++++-
plugins/vala-pack/ide-vala-pipeline-addin.vala | 9 ++++++++-
plugins/vala-pack/ide-vala-service.vala | 19 ++++++++++++++++---
plugins/vala-pack/ide-vala-symbol-resolver.vala | 13 ++++++++++---
6 files changed, 62 insertions(+), 15 deletions(-)
---
diff --git a/plugins/vala-pack/ide-vala-completion-provider.vala
b/plugins/vala-pack/ide-vala-completion-provider.vala
index 234cb33..3fef3cf 100644
--- a/plugins/vala-pack/ide-vala-completion-provider.vala
+++ b/plugins/vala-pack/ide-vala-completion-provider.vala
@@ -22,7 +22,7 @@ using Vala;
namespace Ide
{
- public class ValaCompletionProvider: Ide.Object,
+ public class ValaCompletionProvider: GLib.Object,
Gtk.SourceCompletionProvider,
Ide.CompletionProvider
{
@@ -75,9 +75,9 @@ namespace Ide
buffer.sync_to_unsaved_files ();
- var service = (this.get_context ().get_service_typed (typeof (Ide.ValaService)) as
Ide.ValaService);
+ var service = (this._context.get_service_typed (typeof (Ide.ValaService)) as
Ide.ValaService);
var index = service.index;
- var unsaved_files = this.get_context ().get_unsaved_files ();
+ var unsaved_files = this._context.get_unsaved_files ();
var cancellable = new GLib.Cancellable ();
context.cancelled.connect(() => {
@@ -147,5 +147,12 @@ namespace Ide
}
public void load () {}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+ Ide.Context? _context;
+ public Ide.Context context { construct { _context = value; } }
+ public void set_context (Ide.Context context) { _context = context; }
}
}
diff --git a/plugins/vala-pack/ide-vala-diagnostic-provider.vala
b/plugins/vala-pack/ide-vala-diagnostic-provider.vala
index 03886ce..4033294 100644
--- a/plugins/vala-pack/ide-vala-diagnostic-provider.vala
+++ b/plugins/vala-pack/ide-vala-diagnostic-provider.vala
@@ -22,20 +22,26 @@ using Vala;
namespace Ide
{
- public class ValaDiagnosticProvider: Ide.Object, Ide.DiagnosticProvider
+ public class ValaDiagnosticProvider: GLib.Object, Ide.DiagnosticProvider
{
public async Ide.Diagnostics? diagnose_async (Ide.File file,
Ide.Buffer buffer,
GLib.Cancellable? cancellable)
throws GLib.Error
{
- var context = this.get_context ();
- var service = (Ide.ValaService)context.get_service_typed (typeof (Ide.ValaService));
- yield service.index.parse_file (file.file, context.unsaved_files, cancellable);
+ var service = (Ide.ValaService)_context.get_service_typed (typeof (Ide.ValaService));
+ yield service.index.parse_file (file.file, _context.unsaved_files, cancellable);
var results = yield service.index.get_diagnostics (file.file, cancellable);
return results;
}
public void load () {}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+ Ide.Context? _context;
+ public Ide.Context context { construct { _context = value; } }
+ public void set_context (Ide.Context context) { _context = context; }
}
}
diff --git a/plugins/vala-pack/ide-vala-indenter.vala b/plugins/vala-pack/ide-vala-indenter.vala
index 95e29d5..cd812ce 100644
--- a/plugins/vala-pack/ide-vala-indenter.vala
+++ b/plugins/vala-pack/ide-vala-indenter.vala
@@ -21,7 +21,7 @@ using Ide;
namespace Ide
{
- public class ValaIndenter: Ide.Object, Ide.Indenter
+ public class ValaIndenter: GLib.Object, Ide.Indenter
{
public bool is_trigger (Gdk.EventKey evkey)
{
@@ -180,5 +180,12 @@ namespace Ide
return (prev.get_char () == '{') && (iter.get_char () == '\n') && (next.get_char ()
== '}');
}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+ Ide.Context? _context;
+ public Ide.Context context { construct { _context = value; } }
+ public void set_context (Ide.Context context) { _context = context; }
}
}
diff --git a/plugins/vala-pack/ide-vala-pipeline-addin.vala b/plugins/vala-pack/ide-vala-pipeline-addin.vala
index 3626ca6..03daab7 100644
--- a/plugins/vala-pack/ide-vala-pipeline-addin.vala
+++ b/plugins/vala-pack/ide-vala-pipeline-addin.vala
@@ -23,7 +23,7 @@ using Vala;
namespace Ide
{
- public class ValaPipelineAddin: Ide.Object, Ide.BuildPipelineAddin
+ public class ValaPipelineAddin: GLib.Object, Ide.BuildPipelineAddin
{
// main.vala:24.30-24.30: error: initializer list used for `Gtk.WindowType', which is neither
array nor struct
const string ERROR_FORMAT_REGEX =
@@ -44,5 +44,12 @@ namespace Ide
{
pipeline.remove_error_format (this.error_format);
}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+ Ide.Context? _context;
+ public Ide.Context context { construct { _context = value; } }
+ public void set_context (Ide.Context context) { _context = context; }
}
}
diff --git a/plugins/vala-pack/ide-vala-service.vala b/plugins/vala-pack/ide-vala-service.vala
index 51c7d56..e6ab84f 100644
--- a/plugins/vala-pack/ide-vala-service.vala
+++ b/plugins/vala-pack/ide-vala-service.vala
@@ -22,9 +22,10 @@ using Vala;
namespace Ide
{
- public class ValaService: Ide.Object, Ide.Service
+ public class ValaService: GLib.Object, Ide.Service
{
Ide.ValaIndex _index;
+ Ide.Context? _context;
construct {
}
@@ -38,10 +39,10 @@ namespace Ide
}
public void start () {
- this._index = new Ide.ValaIndex (this.get_context ());
+ this._index = new Ide.ValaIndex (this._context);
Ide.ThreadPool.push (Ide.ThreadPoolKind.INDEXER, () => {
- Ide.Vcs vcs = this.get_context ().get_vcs ();
+ Ide.Vcs vcs = this._context.get_vcs ();
var files = new ArrayList<GLib.File> ();
load_directory (vcs.get_working_directory (), null, files);
@@ -84,5 +85,17 @@ namespace Ide
warning ("%s", err.message);
}
}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+
+ public Ide.Context context {
+ construct { this._context = value; }
+ }
+
+ public void set_context (Ide.Context context) {
+ this._context = context;
+ }
}
}
diff --git a/plugins/vala-pack/ide-vala-symbol-resolver.vala b/plugins/vala-pack/ide-vala-symbol-resolver.vala
index 6f8501e..b7521fa 100644
--- a/plugins/vala-pack/ide-vala-symbol-resolver.vala
+++ b/plugins/vala-pack/ide-vala-symbol-resolver.vala
@@ -22,14 +22,14 @@ using Vala;
namespace Ide
{
- public class ValaSymbolResolver: Ide.Object, Ide.SymbolResolver
+ public class ValaSymbolResolver: GLib.Object, Ide.SymbolResolver
{
public async Ide.SymbolTree? get_symbol_tree_async (GLib.File file,
Ide.Buffer buffer,
GLib.Cancellable? cancellable)
throws GLib.Error
{
- var context = this.get_context ();
+ var context = this._context;
var service = (Ide.ValaService)context.get_service_typed (typeof (Ide.ValaService));
var index = service.index;
var symbol_tree = yield index.get_symbol_tree (file, cancellable);
@@ -41,7 +41,7 @@ namespace Ide
GLib.Cancellable? cancellable)
throws GLib.Error
{
- var context = this.get_context ();
+ var context = this._context;
var service = (Ide.ValaService)context.get_service_typed (typeof (Ide.ValaService));
var index = service.index;
var file = location.get_file ();
@@ -111,6 +111,13 @@ namespace Ide
}
public void load () {}
+
+ // This code shouldn't have to exist.
+ // If we can fixup libide+vala to not have such weird interaction that
+ // would be great.
+ Ide.Context? _context;
+ public Ide.Context context { construct { _context = value; } }
+ public void set_context (Ide.Context context) { _context = context; }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]