Skip to content

Commit eb822cf

Browse files
committed
refactor(compiler): clarify infix cond extraction
Rename extractCondExprSelf to extractInfixCondExpr to distinguish recursive expression-tree extraction from extracting one infix comparison node.
1 parent 83744f7 commit eb822cf

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

compiler/cond.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ func (c *Compiler) extractCondExprs(expr ast.Expression, cond llvm.Value, temps
476476
if infix, ok := expr.(*ast.InfixExpression); ok && info.HasCondScalar() && len(c.pendingLoopRanges(info.Ranges)) == 0 {
477477
cond, temps = c.extractCondExprs(infix.Left, cond, temps)
478478
cond, temps = c.extractCondExprs(infix.Right, cond, temps)
479-
return c.extractCondExprSelf(infix, info, cond, temps)
479+
return c.extractInfixCondExpr(infix, info, cond, temps)
480480
}
481481

482482
// Not a conditional expression — recurse into children
@@ -486,7 +486,7 @@ func (c *Compiler) extractCondExprs(expr ast.Expression, cond llvm.Value, temps
486486
return cond, temps
487487
}
488488

489-
func (c *Compiler) extractCondExprSelf(infix *ast.InfixExpression, info *ExprInfo, cond llvm.Value, temps []condTemp) (llvm.Value, []condTemp) {
489+
func (c *Compiler) extractInfixCondExpr(infix *ast.InfixExpression, info *ExprInfo, cond llvm.Value, temps []condTemp) (llvm.Value, []condTemp) {
490490
left := c.compileExpression(infix.Left, nil)
491491
right := c.compileExpression(infix.Right, nil)
492492

@@ -612,7 +612,7 @@ func (c *Compiler) compileCondExprWithFailure(expr ast.Expression, baseCond llvm
612612
if infix, ok := expr.(*ast.InfixExpression); ok {
613613
info := c.ExprCache[key(c.FuncNameMangled, infix)]
614614
if info != nil && info.HasCondScalar() && len(c.pendingLoopRanges(info.Ranges)) == 0 {
615-
cond, temps := c.extractCondExprSelf(infix, info, llvm.Value{}, nil)
615+
cond, temps := c.extractInfixCondExpr(infix, info, llvm.Value{}, nil)
616616
c.compileCondExprBranch(cond, temps, onTrue, onFalse)
617617
return
618618
}

0 commit comments

Comments
 (0)