[vala/0.48] codegen: Correctly handle transformation of translated string-literal constants
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] codegen: Correctly handle transformation of translated string-literal constants
- Date: Mon, 6 Apr 2020 08:38:04 +0000 (UTC)
commit a404ee999f6b0c600ff398b99dd0d5cacb02ba8f
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Apr 5 11:02:01 2020 +0200
codegen: Correctly handle transformation of translated string-literal constants
The required header includes were not emited to the correct declaration space.
codegen/valaccodebasemodule.vala | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 405d600f7..0883018e6 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -994,6 +994,12 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
decl_space.add_constant_declaration (cdecl);
} else {
+ if (c.value is StringLiteral && ((StringLiteral) c.value).translate) {
+ // translated string constant
+ var m = (Method) root_symbol.scope.lookup ("GLib").scope.lookup ("_");
+ add_symbol_declaration (decl_space, m, get_ccode_name (m));
+ }
+
var cdefine = new CCodeMacroReplacement.with_expression (get_ccode_name (c),
get_cvalue (c.value));
decl_space.add_type_member_declaration (cdefine);
}
@@ -4269,10 +4275,6 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
if (expr.translate) {
// translated string constant
-
- var m = (Method) root_symbol.scope.lookup ("GLib").scope.lookup ("_");
- add_symbol_declaration (cfile, m, get_ccode_name (m));
-
var translate = new CCodeFunctionCall (new CCodeIdentifier ("_"));
translate.add_argument (get_cvalue (expr));
set_cvalue (expr, translate);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]