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

Method binding_strength

prqlc/prqlc/src/sql/gen_expr.rs:1069–1084  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

1067
1068impl SQLExpression for sql_ast::Expr {
1069 fn binding_strength(&self) -> i32 {
1070 // Strength of an expression depends only on the top-level operator, because all
1071 // other nested expressions can only have lower strength
1072 match self {
1073 sql_ast::Expr::BinaryOp { op, .. } => op.binding_strength(),
1074
1075 sql_ast::Expr::UnaryOp { op, .. } => op.binding_strength(),
1076
1077 sql_ast::Expr::Like { .. } | sql_ast::Expr::ILike { .. } => 7,
1078
1079 sql_ast::Expr::IsNull(_) | sql_ast::Expr::IsNotNull(_) => 5,
1080
1081 // all other items types bind stronger (function calls, literals, ...)
1082 _ => 20,
1083 }
1084 }
1085 fn associativity(&self) -> Associativity {
1086 match self {
1087 sql_ast::Expr::BinaryOp { op, .. } => op.associativity(),

Callers 3

process_nullFunction · 0.80
needs_parenthesesFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected