From: Rico Tzschichholz Date: Thu, 5 Jul 2018 05:47:10 +0000 (+0200) Subject: codewriter: Output bodies of code-blocks if in VAPIGEN mode X-Git-Tag: 0.41.90~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=204c7bae660aa96a1ebf69e33f21128575511394;p=thirdparty%2Fvala.git codewriter: Output bodies of code-blocks if in VAPIGEN mode Fixes https://gitlab.gnome.org/GNOME/vala/issues/231 --- diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala index 4535f8873..985a23182 100644 --- a/vala/valacodewriter.vala +++ b/vala/valacodewriter.vala @@ -290,7 +290,7 @@ public class Vala.CodeWriter : CodeVisitor { } void visit_sorted (List symbols) { - if (type != CodeWriterType.EXTERNAL) { + if (type != CodeWriterType.EXTERNAL && type != CodeWriterType.VAPIGEN) { // order of virtual methods matters for fast vapis foreach (Symbol sym in symbols) { sym.accept (this); @@ -1590,7 +1590,7 @@ public class Vala.CodeWriter : CodeVisitor { } void write_code_block (Block? block) { - if (block == null || type != CodeWriterType.DUMP) { + if (block == null || (type != CodeWriterType.DUMP && type != CodeWriterType.VAPIGEN)) { write_string (";"); return; } @@ -1618,6 +1618,7 @@ public class Vala.CodeWriter : CodeVisitor { private bool check_accessibility (Symbol sym) { switch (type) { case CodeWriterType.EXTERNAL: + case CodeWriterType.VAPIGEN: return sym.access == SymbolAccessibility.PUBLIC || sym.access == SymbolAccessibility.PROTECTED; @@ -1732,7 +1733,7 @@ public class Vala.CodeWriter : CodeVisitor { write_string ("private "); } - if (type != CodeWriterType.EXTERNAL && sym.external && !sym.external_package) { + if (type != CodeWriterType.EXTERNAL && type != CodeWriterType.VAPIGEN && sym.external && !sym.external_package) { write_string ("extern "); } } @@ -1768,5 +1769,6 @@ public enum Vala.CodeWriterType { EXTERNAL, INTERNAL, FAST, - DUMP + DUMP, + VAPIGEN } diff --git a/vapigen/valavapigen.vala b/vapigen/valavapigen.vala index e68523cb2..616efdf29 100644 --- a/vapigen/valavapigen.vala +++ b/vapigen/valavapigen.vala @@ -191,7 +191,7 @@ class Vala.VAPIGen { } } - var interface_writer = new CodeWriter (); + var interface_writer = new CodeWriter (CodeWriterType.VAPIGEN); var vapi_filename = "%s.vapi".printf (library); if (directory != null) { vapi_filename = Path.build_path ("/", directory, vapi_filename);