diff options
| author | gingerBill <bill@gingerbill.org> | 2019-10-26 14:43:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-10-26 14:43:06 +0100 |
| commit | 14e8b299b73c87d5c48e73add91d7a427d554d75 (patch) | |
| tree | 03a95a71c5d904fdde0964847e5f49fe0ad77a17 /src/check_expr.cpp | |
| parent | c7cb754514110d7d245ee2508fb8ccae7e24a420 (diff) | |
Fix slice and dynamic array lengths determined from ranged compound literals
Diffstat (limited to 'src/check_expr.cpp')
| -rw-r--r-- | src/check_expr.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 7491094c8..3c4d737a4 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -7209,9 +7209,6 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type if (op.kind == Token_RangeHalf) { hi -= 1; } - if (op.kind == Token_Ellipsis) { - max_index += 1; - } bool new_range = range_cache_add_range(&rc, lo, hi); if (!new_range) { @@ -7229,7 +7226,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type continue; } - if (max < max_index) { + if (max < hi) { max = max_index; } @@ -7272,7 +7269,7 @@ ExprKind check_expr_base_internal(CheckerContext *c, Operand *o, Ast *node, Type } } - cl->max_index = max; + cl->max_count = max; } |