C++: Split CoReturnStmt.getExpr into CoReturnStmt.{getOperand,getExpr}

This commit is contained in:
Ian Lynagh
2020-08-26 17:13:25 +01:00
parent 8b8b9d6fe3
commit 78b522722c

View File

@@ -678,7 +678,22 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
override string getAPrimaryQlClass() { result = "CoReturnStmt" }
/**
* Gets the expression of this 'co_return' statement.
* Gets the operand of this 'co_return' statement.
*
* For example, for
* ```
* co_return 1+2;
* ```
* the operand is a function call `return_value(1+2)`, and for
* ```
* co_return;
* ```
* the operand is a function call `return_void()`.
*/
FunctionCall getOperand() { result = this.getChild(0) }
/**
* Gets the expression of this 'co_return' statement, if any.
*
* For example, for
* ```
@@ -688,10 +703,8 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
* ```
* co_return;
* ```
*
* TODO: Really?
*/
Expr getExpr() { result = this.getChild(0) }
Expr getExpr() { result = this.getOperand().getArgument(0) }
/**
* Holds if this 'co_return' statement has an expression.