astgen.c: fix forExpr to use nodeIsTriviallyZero for range start check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -9924,17 +9924,8 @@ static uint32_t forExpr(
|
||||
lens[i][1] = end_val;
|
||||
}
|
||||
|
||||
// Check if start is trivially zero.
|
||||
bool start_is_zero = false;
|
||||
if (tree->nodes.tags[start_node] == AST_NODE_NUMBER_LITERAL) {
|
||||
uint32_t tok = tree->nodes.main_tokens[start_node];
|
||||
uint32_t ts = tree->tokens.starts[tok];
|
||||
if (tree->source[ts] == '0'
|
||||
&& (ts + 1 >= tree->source_len
|
||||
|| tree->source[ts + 1] < '0'
|
||||
|| tree->source[ts + 1] > '9'))
|
||||
start_is_zero = true;
|
||||
}
|
||||
// Check if start is trivially zero (AstGen.zig:6915).
|
||||
bool start_is_zero = nodeIsTriviallyZero(tree, start_node);
|
||||
indexables[i] = start_is_zero ? ZIR_REF_NONE : start_val;
|
||||
} else {
|
||||
// Regular indexable (AstGen.zig:6918-6923).
|
||||
|
||||
@@ -37,7 +37,7 @@ const corpus_files = .{
|
||||
"../lib/compiler/aro/aro/Builtins/TypeDescription.zig",
|
||||
"../lib/compiler/aro/aro/Builtins.zig",
|
||||
"../lib/compiler/aro/aro/char_info/identifier_tables.zig",
|
||||
//"../lib/compiler/aro/aro/char_info.zig",
|
||||
"../lib/compiler/aro/aro/char_info.zig",
|
||||
"../lib/compiler/aro/aro/CodeGen.zig",
|
||||
"../lib/compiler/aro/aro/Compilation.zig",
|
||||
"../lib/compiler/aro/aro/Diagnostics/messages.zig",
|
||||
|
||||
Reference in New Issue
Block a user