mirror of
https://github.com/Reuh/anselme.git
synced 2025-10-28 09:09:31 +00:00
Change format_priority to a method
This commit is contained in:
parent
d42b900388
commit
07cb44256c
23 changed files with 115 additions and 58 deletions
|
|
@ -7,7 +7,6 @@ local translation_manager
|
|||
|
||||
local Translatable = ast.abstract.Node {
|
||||
type = "translatable",
|
||||
format_priority = operator_priority["%_"],
|
||||
|
||||
expression = nil,
|
||||
|
||||
|
|
@ -15,9 +14,6 @@ local Translatable = ast.abstract.Node {
|
|||
self.expression = expression
|
||||
self.context = ast.Struct:new()
|
||||
self.context:set(String:new("source"), String:new(self.expression.source))
|
||||
if TextInterpolation:is(self.expression) then
|
||||
self.format_priority = expression.format_priority
|
||||
end
|
||||
end,
|
||||
|
||||
_format = function(self, ...)
|
||||
|
|
@ -27,6 +23,13 @@ local Translatable = ast.abstract.Node {
|
|||
return "%"..self.expression:format_right(...)
|
||||
end
|
||||
end,
|
||||
_format_priority = function(self)
|
||||
if TextInterpolation:is(self.expression) then
|
||||
return self.expression:format_priority()
|
||||
else
|
||||
return operator_priority["%_"]
|
||||
end
|
||||
end,
|
||||
|
||||
traverse = function(self, fn, ...)
|
||||
fn(self.expression, ...)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue