Commit 47f1172f authored by Christian Hergert's avatar Christian Hergert
Browse files

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.

https://bugzilla.gnome.org/show_bug.cgi?id=779891
parent 1e97f09c
......@@ -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; }
}
}
......@@ -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; }
}
}
......@@ -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; }
}
}
......@@ -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; }
}
}
......@@ -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;
}
}
}
......@@ -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; }
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment