Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
alpine
awall
Commits
5a4cb73b
Commit
5a4cb73b
authored
Jan 31, 2017
by
Kaarle Ritvanen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rule: fix corner cases for chain combiner
parent
0df4dab4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
awall/model.lua
awall/model.lua
+16
-8
No files found.
awall/model.lua
View file @
5a4cb73b
...
...
@@ -446,7 +446,7 @@ function M.Rule:combine(ofs1, ofs2, key, unique)
end
local
chainless
=
filter
(
ofs2
,
function
(
of
)
return
not
of
.
chain
end
)
local
created
=
{}
local
created
local
res
=
{}
for
_
,
of
in
ipairs
(
ofs1
)
do
...
...
@@ -455,16 +455,24 @@ function M.Rule:combine(ofs1, ofs2, key, unique)
local
ofs
=
combinations
(
chainless
,
{{
family
=
of
.
family
}})
assert
(
#
ofs
>
0
)
if
unique
then
assert
(
of
.
family
)
if
created
[
of
.
family
]
then
return
connect
()
end
created
[
of
.
family
]
=
true
local
comb
=
combinations
({
of
},
ofs
)
if
#
comb
<
#
ofs
then
return
connect
()
end
if
#
ofs
>
1
then
return
connect
()
end
if
unique
then
for
_
,
c
in
ipairs
(
comb
)
do
if
c
.
family
then
if
not
created
then
created
=
{}
elseif
created
==
true
or
created
[
c
.
family
]
then
return
connect
()
end
created
[
c
.
family
]
=
true
else
if
created
then
return
connect
()
end
created
=
true
end
end
end
local
comb
=
combinations
({
of
},
ofs
)
if
#
comb
<
#
ofs
then
return
connect
()
end
extend
(
res
,
comb
)
else
table.insert
(
res
,
of
)
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment