Skip to content

Commit

Permalink
nixd/Sema: lowering for ExprIf
Browse files Browse the repository at this point in the history
  • Loading branch information
euphgh authored and inclyc committed Sep 23, 2023
1 parent 7169555 commit 6634f0f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions nixd/lib/Sema/Lowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ nix::Expr *Lowering::lower(const syntax::Node *Root) {
auto *Ret = new nix::ExprLet(Attrs, Body);
return Ret;
}
case Node::NK_If: {
const auto *If = dynamic_cast<const syntax::If *>(Root);
auto *Cond = lower(If->Cond);
auto *Then = lower(If->Then);
auto *Else = lower(If->Else);
auto *NixIf =
Ctx.Pool.record(new nix::ExprIf(If->Range.Begin, Cond, Then, Else));
return NixIf;
}
}

return nullptr;
Expand Down

0 comments on commit 6634f0f

Please sign in to comment.