MCPcopy Create free account
hub / github.com/PRQL/prql / translate_operand

Function translate_operand

prqlc/prqlc/src/sql/gen_expr.rs:970–984  ·  view source on GitHub ↗
(
    expr: rq::Expr,
    is_left: bool,
    parent_strength: i32,
    parent_associativity: Associativity,
    context: &mut Context,
)

Source from the content-addressed store, hash-verified

968}
969
970pub(super) fn translate_operand(
971 expr: rq::Expr,
972 is_left: bool,
973 parent_strength: i32,
974 parent_associativity: Associativity,
975 context: &mut Context,
976) -> Result<ExprOrSource> {
977 let expr = translate_expr(expr, context)?;
978
979 if needs_parentheses(&expr, is_left, parent_strength, parent_associativity) {
980 Ok(expr.wrap_in_parenthesis())
981 } else {
982 Ok(expr)
983 }
984}
985
986/// For an operation represented as `a child b` with a surrounding parent
987/// operation (e.g., `(a child b) parent c` or `a parent (b child c)`):

Callers 4

process_nullFunction · 0.85
try_into_betweenFunction · 0.85
translate_operatorFunction · 0.85

Calls 3

translate_exprFunction · 0.85
needs_parenthesesFunction · 0.85
wrap_in_parenthesisMethod · 0.80

Tested by

no test coverage detected