From: Jürg Billeter Date: Mon, 11 Oct 2010 19:07:34 +0000 (+0200) Subject: Fix use of N_ in constant initializers X-Git-Tag: 0.11.1~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1ad9c108cd772cfd652183af1af3c6afae575ae8;p=thirdparty%2Fvala.git Fix use of N_ in constant initializers --- diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index 23a109a49..5a3b8dd18 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -710,6 +710,25 @@ public class Vala.MethodCall : Expression { public override void emit (CodeGenerator codegen) { var method_type = call.value_type as MethodType; + if (method_type != null) { + // N_ and NC_ do not have any effect on the C code, + // they are only interpreted by xgettext + // this means that it is ok to use them in constant initializers + // however, we must avoid generating regular method call code + // as that may include temporary variables + if (method_type.method_symbol.get_full_name () == "GLib.N_") { + // first argument is string + argument_list[0].emit (codegen); + this.target_value = argument_list[0].target_value; + return; + } else if (method_type.method_symbol.get_full_name () == "GLib.NC_") { + // second argument is string + argument_list[1].emit (codegen); + this.target_value = argument_list[1].target_value; + return; + } + } + if (method_type != null && method_type.method_symbol.parent_symbol is Signal) { var signal_access = ((MemberAccess) call).inner; signal_access.emit (codegen);