src/i18n_phase: breakup 2 complexe lines of code
authorAlexis Laferrière <alexis.laf@xymus.net>
Sat, 20 Jun 2015 11:48:51 +0000 (07:48 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Sun, 21 Jun 2015 21:09:20 +0000 (17:09 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

src/frontend/i18n_phase.nit

index 32fa326..dc550af 100644 (file)
@@ -130,8 +130,9 @@ end
 redef class AStringExpr
 
        redef fun accept_string_finder(v) do
 redef class AStringExpr
 
        redef fun accept_string_finder(v) do
-               var parse = v.toolcontext.parse_expr("\"{str}\".get_translation(\"{v.domain}\", \"{v.languages_location}\").unescape_nit")
                var str = value.as(not null).escape_to_gettext
                var str = value.as(not null).escape_to_gettext
+               var code = "\"{str}\".get_translation(\"{v.domain}\", \"{v.languages_location}\").unescape_nit"
+               var parse = v.toolcontext.parse_expr(code)
                replace_with(parse)
                v.add_string(str, location)
        end
                replace_with(parse)
                v.add_string(str, location)
        end
@@ -154,7 +155,8 @@ redef class ASuperstringExpr
                end
                fmt = fmt.escape_to_gettext
                v.add_string(fmt, location)
                end
                fmt = fmt.escape_to_gettext
                v.add_string(fmt, location)
-               var parse = v.toolcontext.parse_expr("\"{fmt}\".get_translation(\"{v.domain}\", \"{v.languages_location}\").unescape_nit.format()")
+               var code = "\"{fmt}\".get_translation(\"{v.domain}\", \"{v.languages_location}\").unescape_nit.format()"
+               var parse = v.toolcontext.parse_expr(code)
                if not parse isa ACallExpr then
                        v.toolcontext.error(location, "Fatal error in i18n annotation, the parsed superstring could not be generated properly")
                        return
                if not parse isa ACallExpr then
                        v.toolcontext.error(location, "Fatal error in i18n annotation, the parsed superstring could not be generated properly")
                        return