@@ -45,8 +45,6 @@ class ExprOrType extends @expr_or_type, Documentable {
4545 exists ( DotExpr dot | this = dot .getProperty ( ) | result = dot .getDocumentation ( ) )
4646 or
4747 exists ( AssignExpr e | this = e .getRhs ( ) | result = e .getDocumentation ( ) )
48- or
49- exists ( ParExpr p | this = p .getExpression ( ) | result = p .getDocumentation ( ) )
5048 )
5149 }
5250
@@ -109,6 +107,12 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
109107 /** Gets this expression, with any surrounding parentheses removed. */
110108 override Expr stripParens ( ) { result = this }
111109
110+ /** Holds if this expression is wrapped in parentheses. */
111+ predicate isParenthesized ( ) { has_parentheses ( this , _) }
112+
113+ /** Gets the number of enclosing parentheses around this expression. */
114+ int getParenthesisDepth ( ) { has_parentheses ( this , result ) }
115+
112116 /** Gets the constant integer value this expression evaluates to, if any. */
113117 int getIntValue ( ) { none ( ) }
114118
@@ -235,9 +239,6 @@ class Expr extends @expr, ExprOrStmt, ExprOrType, AST::ValueNode {
235239 this = ctx .( ForOfStmt ) .getIterationDomain ( )
236240 or
237241 // recursive cases
238- this = ctx .( ParExpr ) .getExpression ( ) and
239- ctx .( ParExpr ) .inNullSensitiveContext ( )
240- or
241242 this = ctx .( SeqExpr ) .getLastOperand ( ) and
242243 ctx .( SeqExpr ) .inNullSensitiveContext ( )
243244 or
@@ -351,6 +352,11 @@ class Literal extends @literal, Expr {
351352/**
352353 * A parenthesized expression.
353354 *
355+ * Note: in new databases, parenthesized expressions are not represented as separate
356+ * AST nodes. Instead, the inner expression takes the place of the parenthesized
357+ * expression and `Expr.isParenthesized()` indicates whether it was wrapped in
358+ * parentheses. This class is retained for backwards compatibility with old databases.
359+ *
354360 * Example:
355361 *
356362 * ```
0 commit comments