fieldAccess

Coverity Documentation

Version
latest

Matches all accesses to fields.

This pattern only matches nodes of type expression.

Properties

fieldAccess produces a record that contains the following properties:

Name Type Description
field symbol The symbol of the field being accessed
objectExpression expression The object that owns the field being accessed

Inherits properties from:

Example

For a Java class like this:


Java code follows
Example {
    public int myPublicInt;
};

... and an access like this:


Java code follows
Example e;
    int i = e.myPublicInt;

... the following CodeXM pattern finds the access:


CXM code follows
    pattern accessToExamplePublicInt {
        fieldAccess {
            .objectExpression == expression {
                .type == classType { .simpleName == "Example" }
            };
            .field == symbol { .simpleName == "myPublicInt" }
        }
    };