mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
JS: address review comments
This commit is contained in:
@@ -45,11 +45,23 @@ class ExprOrType extends @exprortype, Documentable {
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets this expression or type, with any surrounding parentheses removed. */
|
||||
/**
|
||||
* Gets this expression or type, with any surrounding parentheses removed.
|
||||
*
|
||||
* Also see `getUnderlyingValue` and `getUnderlyingReference`.
|
||||
*/
|
||||
ExprOrType stripParens() { result = this }
|
||||
|
||||
/**
|
||||
* Gets the innermost reference that this expression evaluates to, if any.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* - a variable or property access: the access itself.
|
||||
* - a parenthesized expression `(e)`: the underlying reference of `e`.
|
||||
* - a TypeScript type assertion `e as T`: the underlying reference of `e`.
|
||||
*
|
||||
* Also see `getUnderlyingValue` and `stripParens`.
|
||||
*/
|
||||
Expr getUnderlyingReference() {
|
||||
none()
|
||||
@@ -57,6 +69,16 @@ class ExprOrType extends @exprortype, Documentable {
|
||||
|
||||
/**
|
||||
* Gets the innermost expression that this expression evaluates to.
|
||||
*
|
||||
* Examples:
|
||||
*
|
||||
* - a parenthesised expression `(e)`: the underlying value of `e`.
|
||||
* - a sequence expression `e1, e2`: the underlying value of `e2`.
|
||||
* - an assignment expression `v = e`: the underlying value of `e`.
|
||||
* - a TypeScript type assertion `e as T`: the underlying value of `e`.
|
||||
* - any other expression: the expression itself.
|
||||
*
|
||||
* Also see `getUnderlyingReference` and `stripParens`.
|
||||
*/
|
||||
Expr getUnderlyingValue() {
|
||||
result = this
|
||||
@@ -1319,15 +1341,17 @@ class Assignment extends @assignment, Expr {
|
||||
result = getLhs().getFirstControlFlowNode()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** A simple assignment expression. */
|
||||
class AssignExpr extends @assignexpr, Assignment {
|
||||
|
||||
override Expr getUnderlyingValue() {
|
||||
result = getRhs().getUnderlyingValue()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** A simple assignment expression. */
|
||||
class AssignExpr extends @assignexpr, Assignment {}
|
||||
|
||||
/** A compound assign expression. */
|
||||
abstract class CompoundAssignExpr extends Assignment {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user