Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/analyze.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static AST_NODE_T* create_control_node(
if (end_node) {
end_position = end_node->base.location.end;
} else if (children && hb_array_size(children) > 0) {
AST_NODE_T* last_child = hb_array_get(children, hb_array_size(children) - 1);
AST_NODE_T* last_child = hb_array_last(children);
end_position = last_child->location.end;
} else if (subsequent) {
end_position = subsequent->location.end;
Expand Down Expand Up @@ -695,10 +695,10 @@ static size_t process_control_structure(
} else if (else_clause) {
end_position = else_clause->base.location.end;
} else if (hb_array_size(when_conditions) > 0) {
AST_NODE_T* last_when = hb_array_get(when_conditions, hb_array_size(when_conditions) - 1);
AST_NODE_T* last_when = hb_array_last(when_conditions);
end_position = last_when->location.end;
} else if (hb_array_size(in_conditions) > 0) {
AST_NODE_T* last_in = hb_array_get(in_conditions, hb_array_size(in_conditions) - 1);
AST_NODE_T* last_in = hb_array_last(in_conditions);
end_position = last_in->location.end;
}

Expand Down Expand Up @@ -955,7 +955,7 @@ static size_t process_control_structure(
if (end_node) {
end_position = end_node->base.location.end;
} else if (children && hb_array_size(children) > 0) {
AST_NODE_T* last_child = hb_array_get(children, hb_array_size(children) - 1);
AST_NODE_T* last_child = hb_array_last(children);
end_position = last_child->location.end;
}

Expand Down Expand Up @@ -1139,7 +1139,7 @@ static size_t process_block_children(
hb_array_T* temp_array = hb_array_init(1);
size_t new_index = process_control_structure(node, array, index, temp_array, context, child_type);

if (hb_array_size(temp_array) > 0) { hb_array_append(children_array, hb_array_get(temp_array, 0)); }
if (hb_array_size(temp_array) > 0) { hb_array_append(children_array, hb_array_first(temp_array)); }

hb_array_free(&temp_array);

Expand Down
4 changes: 2 additions & 2 deletions src/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,8 @@ static AST_HTML_ATTRIBUTE_NAME_NODE_T* parser_parse_html_attribute_name(parser_T
position_T node_end = { 0 };

if (children->size > 0) {
AST_NODE_T* first_child = hb_array_get(children, 0);
AST_NODE_T* last_child = hb_array_get(children, children->size - 1);
AST_NODE_T* first_child = hb_array_first(children);
AST_NODE_T* last_child = hb_array_last(children);

node_start = first_child->location.start;
node_end = last_child->location.end;
Expand Down
Loading