destructuringParameter

Coverity Documentation

Version
latest

Matches JavaScript destructuring parameters.

This pattern only matches nodes of type expression.

Properties

destructuringParameter produces a record that contains the following properties:

Name Type Description
 originalParameter expression The reference to the original parameter
parameterList list<record> The list that contains the parameters and their default values

Inherits properties from:

Example

Matches the declaration of the parameter in the following function:

JavaScript code follows
    function f({name = 'a', age}) {
        return name + age;
    };

In this instance, the .originalParameter property is a reference to parameter {name, age}, and the .parameterList property is a list of two record elements. The first element has the .defaultExpression property, which is literal 'a', and the parameter property which is a reference to the variable name. The second element has a null .defaultExpression property, and the .parameter property, which is a reference to the variable age.