ANTAREX API

Clava API

LARA API

LARA Common Language API

(.js)
laraImport("clava.code.SimplifyTernaryOp");

(.lara)
import clava.code.SimplifyTernaryOp;

Global Functions

SimplifyTernaryOp

SimplifyTernaryOp($assignmentStmt)

Simplifies a statement like:

```c
x = y ? a : b;
```

Into:

```c
if (y) {
x = a;
} else {
x = b;
}
```

$assignmentStmt must be an expression statement (not an inline expression, such as in a
varDecl or within another expression). The expression statement must only contain an assignment
operator, and the rvalue must be a ternary operator.

Otherwise the function will immediately return.

Parameters

$assignmentStmt: $exprStmt - Expression statement containing an assignment where the right hand side is a ternary operator