Skip to content

Commit

Permalink
use none instead of 0 for empty fill
Browse files Browse the repository at this point in the history
  • Loading branch information
AjaniBilby committed Mar 21, 2024
1 parent 9072edc commit 73e041a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/compiler/codegen/expression/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,17 @@ function ShouldZero(syntax: Syntax.Term_Container) {
const chain = elms.value[1];
const lastI = chain.value.length-1;

const last_item = lastI > 0
const last_item = 0 <= lastI
? chain.value[lastI].value[0].value[0]
: elms.value[0].value[0];

if (last_item.type === "container_map") return false;

const expr_arg = MaybeSingularExprArg(last_item.value[0]);
if (!expr_arg) return false;
if (expr_arg.type !== "constant") return false;
if (expr_arg === null) return false;
if (expr_arg.type !== "name") return false;

const constant = expr_arg.value[0];
if (constant.type !== "integer") return false;

return constant.value[0].value === "0";
return expr_arg.value[0].value === "none";
}

function MaybeNestedContainer(syntax: Syntax.Term_Expr) {
Expand Down

0 comments on commit 73e041a

Please sign in to comment.