mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
clarify comment
This commit is contained in:
parent
889abaa3b4
commit
3fb6736f7c
1 changed files with 9 additions and 2 deletions
|
@ -2189,8 +2189,15 @@ fn list_literal<'a, 'ctx, 'env>(
|
||||||
let global = {
|
let global = {
|
||||||
let mut global_elements = Vec::with_capacity_in(list_length, env.arena);
|
let mut global_elements = Vec::with_capacity_in(list_length, env.arena);
|
||||||
|
|
||||||
// insert NULL bytes for the refcount
|
// Add zero bytes that represent the refcount
|
||||||
// these elements are (dropped again if the list contains non-constants)
|
//
|
||||||
|
// - if all elements are const, then we store the whole list as a constant.
|
||||||
|
// It then needs a refcount before the first element.
|
||||||
|
// - but if the list is not all constants, then we will just copy the constant values,
|
||||||
|
// and we do not need that refcount at the start
|
||||||
|
//
|
||||||
|
// In the latter case, we won't store the zeros in the globals
|
||||||
|
// (we slice them off again below)
|
||||||
for _ in 0..zero_elements {
|
for _ in 0..zero_elements {
|
||||||
global_elements.push(element_type.const_zero());
|
global_elements.push(element_type.const_zero());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue