[anjuta] language-support-vala: update to latest libvala (0.12 branch)
- From: Abderrahim Kitouni <akitouni src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] language-support-vala: update to latest libvala (0.12 branch)
- Date: Sat, 13 Nov 2010 17:25:35 +0000 (UTC)
commit f2db24c7cde2c0b3ac16823a2a3e977963e9942c
Author: Abderrahim Kitouni <a kitouni gmail com>
Date: Sat Nov 13 10:11:28 2010 +0100
language-support-vala: update to latest libvala (0.12 branch)
configure.ac | 4 +-
plugins/language-support-vala/Makefile.am | 2 +-
plugins/language-support-vala/plugin.vala | 68 +++++++--------------------
plugins/language-support-vala/provider.vala | 4 +-
4 files changed, 22 insertions(+), 56 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 86859ba..b0b7d8b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -53,7 +53,7 @@ dnl Glade
GLADEUI_REQUIRED=3.7.1
dnl Vala
-VALA_REQUIRED=0.9.5
+VALA_REQUIRED=0.11.2
dnl Introspection
GI_REQUIRED=0.9.5
@@ -289,7 +289,7 @@ else
fi
if test x$enable_vala = xyes; then
- AC_PATH_PROG(VALAC, valac, valac)
+ AC_PATH_PROGS(VALAC, [valac-0.12 valac], valac)
AC_SUBST(VALAC)
fi
diff --git a/plugins/language-support-vala/Makefile.am b/plugins/language-support-vala/Makefile.am
index 7baa520..421844b 100644
--- a/plugins/language-support-vala/Makefile.am
+++ b/plugins/language-support-vala/Makefile.am
@@ -31,7 +31,7 @@ AM_CPPFLAGS = \
-DG_LOG_DOMAIN=\"language-support-vala\" \
--no-warn
-VALAFLAGS = --vapidir $(srcdir) --pkg vala-0.10 --pkg libanjuta-1.0
+VALAFLAGS = --vapidir $(srcdir) --pkg libvala-0.12 --pkg libanjuta-1.0
# The plugin
plugindir = $(anjuta_plugin_dir)
diff --git a/plugins/language-support-vala/plugin.vala b/plugins/language-support-vala/plugin.vala
index 02e0474..fe2166b 100644
--- a/plugins/language-support-vala/plugin.vala
+++ b/plugins/language-support-vala/plugin.vala
@@ -35,6 +35,9 @@ public class ValaPlugin : Plugin {
Vala.SymbolResolver resolver;
Vala.SemanticAnalyzer analyzer;
+ ValaPlugin () {
+ Object ();
+ }
public override bool activate () {
//debug("Activating ValaPlugin");
context = new Vala.CodeContext();
@@ -45,14 +48,12 @@ public class ValaPlugin : Plugin {
var project = (IAnjuta.ProjectManager) shell.get_object("IAnjutaProjectManager");
weak List<string> packages = project.get_packages();
- add_package(context, "glib-2.0");
- add_package(context, "gobject-2.0");
+ context.add_package("glib-2.0");
+ context.add_package("gobject-2.0");
var status = shell.get_status ();
- foreach(var pkg in packages) {
- if (!add_package(context, pkg))
- status.set("Package %s not found", pkg);
- }
+ foreach (var pkg in packages)
+ context.add_package(pkg);
source_files = new Vala.HashMap<string, Vala.SourceFile>(str_hash, str_equal, direct_equal);
@@ -60,20 +61,20 @@ public class ValaPlugin : Plugin {
foreach (var src in sources) {
if (src.get_path() != null && !source_files.contains(src.get_path())) {
if (src.get_basename().has_suffix("vala") || src.get_basename().has_suffix("gs")) {
- var vsrc = new Vala.SourceFile(context, src.get_path());
+ var vsrc = new Vala.SourceFile(context, Vala.SourceFileType.SOURCE, src.get_path());
context.add_source_file(vsrc);
var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
vsrc.add_using_directive (ns_ref);
context.root.add_using_directive (ns_ref);
source_files[src.get_path()] = vsrc;
} else if (src.get_basename().has_suffix("vapi")) {
- var vsrc = new Vala.SourceFile (context, src.get_path(), true);
+ var vsrc = new Vala.SourceFile (context, Vala.SourceFileType.PACKAGE, src.get_path());
context.add_source_file(vsrc);
source_files[src.get_path()] = vsrc;
}
}
}
- ThreadFunc parse = () => {
+ ThreadFunc<void*> parse = () => {
lock (context) {
Vala.CodeContext.push(context);
var report = context.report as AnjutaReport;
@@ -104,7 +105,7 @@ public class ValaPlugin : Plugin {
};
try {
- Thread.create(parse, false);
+ Thread.create<void*>(parse, false);
debug("Using threads");
} catch (ThreadError err) {
parse();
@@ -194,7 +195,10 @@ public class ValaPlugin : Plugin {
var path = file.get_file().get_path();
lock (context) {
if (!(path in source_files)) {
- var src = new Vala.SourceFile(context, path, path.has_suffix("vapi"));
+ var src = new Vala.SourceFile(context,
+ path.has_suffix("vapi") ? Vala.SourceFileType.PACKAGE:
+ Vala.SourceFileType.SOURCE,
+ path);
context.add_source_file(src);
source_files[path] = src;
update_file(src);
@@ -275,8 +279,8 @@ public class ValaPlugin : Plugin {
} else if (sym is Vala.Property) {
var prop = (Vala.Property) sym;
result.concat (symbol_lookup_inherited (prop.property_type.data_type, name, prefix_match));
- } else if (sym is Vala.FormalParameter) {
- var fp = (Vala.FormalParameter) sym;
+ } else if (sym is Vala.Parameter) {
+ var fp = (Vala.Parameter) sym;
result.concat (symbol_lookup_inherited (fp.variable_type.data_type, name, prefix_match));
}
@@ -326,44 +330,6 @@ public class ValaPlugin : Plugin {
}
}
-
-/* Copied from valac */
-public bool add_package (Vala.CodeContext context, string pkg) {
- if (context.has_package (pkg)) {
- // ignore multiple occurences of the same package
- return true;
- }
- var package_path = context.get_package_path (pkg, new string[]{});
-
- if (package_path == null) {
- return false;
- }
-
- context.add_package (pkg);
-
- context.add_source_file (new Vala.SourceFile (context, package_path, true));
-
- var deps_filename = Path.build_filename (Path.get_dirname (package_path), "%s.deps".printf (pkg));
- if (FileUtils.test (deps_filename, FileTest.EXISTS)) {
- try {
- string deps_content;
- ulong deps_len;
- FileUtils.get_contents (deps_filename, out deps_content, out deps_len);
- foreach (string dep in deps_content.split ("\n")) {
- if (dep != "") {
- if (!add_package (context, dep)) {
- context.report.err (null, "%s, dependency of %s, not found in specified Vala API directories".printf (dep, pkg));
- }
- }
- }
- } catch (FileError e) {
- context.report.err (null, "Unable to read dependency file: %s".printf (e.message));
- }
- }
-
- return true;
-}
-
[ModuleInit]
public Type anjuta_glue_register_components (TypeModule module) {
return typeof (ValaPlugin);
diff --git a/plugins/language-support-vala/provider.vala b/plugins/language-support-vala/provider.vala
index 9197cb3..b812f33 100644
--- a/plugins/language-support-vala/provider.vala
+++ b/plugins/language-support-vala/provider.vala
@@ -26,7 +26,7 @@ public class ValaProvider : Object, IAnjuta.Provider {
const string PREF_AUTOCOMPLETE_ENABLE = "cpp-completion-enable";
const string PREF_SPACE_AFTER_FUNC = "cpp-completion-space-after-func";
const string PREF_BRACE_AFTER_FUNC = "cpp-code-brace-after-func";
- const string PREF_CALLTIP_ENABLE = "cpp-calltip-enable";
+ internal const string PREF_CALLTIP_ENABLE = "cpp-calltip-enable";
static construct {
try {
@@ -137,7 +137,7 @@ public class ValaProvider : Object, IAnjuta.Provider {
false, plugin.get_current_block (editor));
foreach (var sym in syms) {
- Vala.List<Vala.FormalParameter> parameters = null;
+ Vala.List<Vala.Parameter> parameters = null;
if (sym is Vala.Method) {
parameters = ((Vala.Method) sym).get_parameters ();
} else if (sym is Vala.Signal) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]