cIndex 0 check

This commit is contained in:
reverend 2021-03-19 12:23:43 +01:00
parent 00f69e67c7
commit 61290fb71d

View File

@ -5,7 +5,7 @@ _bem_context = {
known_names: {}
}
//bem_debug = false !default
bem_debug = false
work_stack(stack, callback)
while length(stack) > 0
@ -114,7 +114,7 @@ filter(list, value_list)
push(filtered, element)
return filtered
RV-Level(name_delimiter, selector_callback, name=null, super_parents=null)
RV-Level(name_delimiter, selector_callback, name=null)
call_stack = split(' ', ''+called-from)
call_stack = filter(call_stack, ('RV-Level' 'RV-Block' 'RV-Block--modifier' 'RV-Element' 'RV-Element--modifier' 'RV-Modifier'))
@ -124,7 +124,6 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null)
name = auto_name(name_delimiter, mixin_name)
cindex = contigious_index(call_stack)
nested_in_super_parents = is_nested_in(super_parents)
if bem_debug
--attempt mixin_name
@ -132,7 +131,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null)
--nested_in_super_parents nested_in_super_parents
// TODO Clear up this logic
if cindex == -1 || nested_in_super_parents
if cindex != 0
if name == null
name = pop_last_alias()
name = lookup_alias(name)
@ -142,7 +141,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null)
if name == ''
selector_name = split(name_delimiter, selector_name)[0]
if cindex != -1 && nested_in_super_parents && !(name in _bem_context.known_names)
if cindex > 0 && !(name in _bem_context.known_names)
return
else
_bem_context.known_names[name] = name
@ -153,7 +152,7 @@ RV-Level(name_delimiter, selector_callback, name=null, super_parents=null)
if bem_debug
--mixin_name mixin_name
--name name
else if cindex <= 0
else
store_alias(name)
{block}
if bem_debug