Skip to content

Commit f08791a

Browse files
committed
Refactor variable names to be more consistent
1 parent 528daa9 commit f08791a

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

fluent/_nodes.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ function FluentNode:_init (ast, resource)
3030
end
3131
end
3232
end
33-
tablex.foreachi(ast, function (leaf) self:inject(leaf_to_node(leaf, resource)) end)
33+
tablex.foreachi(ast, function (leaf)
34+
local node = leaf_to_node(leaf, resource)
35+
self:inject(node)
36+
end)
3437
end
3538

3639
function FluentNode:inject (node)
@@ -111,16 +114,16 @@ end
111114

112115
function FTL.Message:set_attribute (attribute)
113116
local id = attribute.id.name
114-
local attributes = rawget(self, "attributes")
115-
local map = rawget(getmetatable(attributes), "map")
117+
local attributes = self.attributes
118+
local map = getmetatable(attributes).map
116119
local k = #attributes + 1
117120
attributes[k] = attribute
118121
map[id] = k
119122
end
120123

121124
function FTL.Message:get_attribute (attribute)
122-
local attributes = rawget(self, "attributes")
123-
local map = rawget(getmetatable(attributes), "map")
125+
local attributes = self.attributes
126+
local map = getmetatable(attributes).map
124127
local k = map[attribute]
125128
return attributes[k]
126129
end

fluent/resource.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ function FluentResource:get_message (identifier, isterm)
6969
local k = map[name]
7070
local entry = body[k]
7171
if not entry then return end
72-
local attr = string.match(identifier, "%.([(%a[-_%a%d]+)$")
73-
return attr and entry:get_attribute(attr) or entry
72+
local attribute = string.match(identifier, "%.([(%a[-_%a%d]+)$")
73+
return attribute and entry:get_attribute(attribute) or entry
7474
end
7575

7676
function FluentResource:get_term (identifier)

0 commit comments

Comments
 (0)