| ... | @@ -881,7 +881,15 @@ fn transformExpression( | ... | @@ -881,7 +881,15 @@ fn transformExpression( |
| 881 | else => @compileError(unreachable), | 881 | else => @compileError(unreachable), |
| 882 | }; | 882 | }; |
| 883 | | 883 | |
| 884 | if (value != 0 and text[0] == '0' and (text.len == 1 or text[1] != '.')) { | 884 | const has_zero_prefix = value != 0 and |
| | 885 | text[0] == '0' and |
| | 886 | (text.len == 1 or switch (tag) { |
| | 887 | .number_int => text[1] >= '0' and text[1] < '9', |
| | 888 | .number_float => text[1] != '.', |
| | 889 | else => @compileError(unreachable), |
| | 890 | }); |
| | 891 | |
| | 892 | if (has_zero_prefix) { |
| 885 | try t.report.warn(.zero_prefixed_literal, .{ .token = t.ast.nodeToken(node) }); | 893 | try t.report.warn(.zero_prefixed_literal, .{ .token = t.ast.nodeToken(node) }); |
| 886 | } | 894 | } |
| 887 | | 895 | |