integrated-application-development / integrated-application-development/sonar-delphi
Apply directives to the closest context instead of to subsequent code
- Dominant language
- Java
- Stars
- 159
- Forks
- 31
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 4
Description
### Prerequisites
- [X] This improvement has not already been suggested.
- [X] This improvement would be generally useful, not specific to my code or setup.
### Engine area
Delphi language support
### Improvement description
Currently, SonarDelphi "applies" a compiler directive when it is encountered. In Delphi, however, a compiler directive is applied at the beginning of whatever context it is in (which is not well defined). For example, the following prints "1":
```delphi
S := '01';
WriteLn(S[1 {$ZEROBASEDSTRINGS ON}]);
```
### Rationale
SonarDelphi is handling Delphi's semantics incorrectly.
Contributor guide
Assessment
This issue has not been assessed yet.