MCPcopy Create free account
hub / github.com/bazelbuild/bazel / evalBinaryOperator

Method evalBinaryOperator

src/main/java/net/starlark/java/eval/Eval.java:608–626  ·  view source on GitHub ↗
(StarlarkThread.Frame fr, BinaryOperatorExpression binop)

Source from the content-addressed store, hash-verified

606 }
607
608 private static Object evalBinaryOperator(StarlarkThread.Frame fr, BinaryOperatorExpression binop)
609 throws EvalException, InterruptedException {
610 Object x = eval(fr, binop.getX());
611 // AND and OR require short-circuit evaluation.
612 switch (binop.getOperator()) {
613 case AND:
614 return Starlark.truth(x) ? eval(fr, binop.getY()) : x;
615 case OR:
616 return Starlark.truth(x) ? x : eval(fr, binop.getY());
617 default:
618 Object y = eval(fr, binop.getY());
619 try {
620 return EvalUtils.binaryOp(binop.getOperator(), x, y, fr.thread);
621 } catch (EvalException ex) {
622 fr.setErrorLocation(binop.getOperatorLocation());
623 throw ex;
624 }
625 }
626 }
627
628 private static Object evalConditional(StarlarkThread.Frame fr, ConditionalExpression cond)
629 throws EvalException, InterruptedException {

Callers 1

evalMethod · 0.95

Calls 8

evalMethod · 0.95
truthMethod · 0.95
binaryOpMethod · 0.95
getYMethod · 0.80
setErrorLocationMethod · 0.80
getXMethod · 0.45
getOperatorMethod · 0.45
getOperatorLocationMethod · 0.45

Tested by

no test coverage detected