Skip to content

Commit 5ea142d

Browse files
euphghinclyc
authored andcommittedSep 23, 2023
nixd/Sema: lowering for ExprIf
1 parent f48a4d5 commit 5ea142d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎nixd/lib/Sema/Lowering.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,15 @@ nix::Expr *Lowering::lower(const syntax::Node *Root) {
436436
auto *Ret = new nix::ExprLet(Attrs, Body);
437437
return Ret;
438438
}
439+
case Node::NK_If: {
440+
const auto *If = dynamic_cast<const syntax::If *>(Root);
441+
auto *Cond = lower(If->Cond);
442+
auto *Then = lower(If->Then);
443+
auto *Else = lower(If->Else);
444+
auto *NixIf =
445+
Ctx.Pool.record(new nix::ExprIf(If->Range.Begin, Cond, Then, Else));
446+
return NixIf;
447+
}
439448
}
440449

441450
return nullptr;

0 commit comments

Comments
 (0)