Skip to content

Commit

Permalink
improved readability of operator declaration locations
Browse files Browse the repository at this point in the history
  • Loading branch information
jurgenvinju committed Feb 29, 2024
1 parent 521eeb4 commit 6ef007d
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/lang/cpp/internal/BindingsResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,8 @@ private ISourceLocation ownedBinding(IBinding binding, String scheme, String pos

private String renameOperators(String name) {
if (isOperatorName(name)) {
// remove the additional spaces to avoid accidental synonyms
name = name.replaceAll(" ", "");
// wrap the operator in braces to disambiguate from possible methods with names like "operatordelete"
name = "operator(" + name.substring("operator".length()) + ")";
name = "operator(" + name.substring("operator ".length()) + ")";
}

return name;
Expand Down Expand Up @@ -715,17 +713,7 @@ else if (binding.getName().startsWith("~")) {
}

private boolean isOperatorName(String name) {
if (name.startsWith("operator")) {
if (name.matches("[<>\\-+*/=%!&\\|\\^\\?\\.\\[\\]]")) {
return true;
}

if (name.endsWith(" delete") || name.endsWith(" new")) {
return true;
}
}

return false;
return name.startsWith("operator ");
}

private ISourceLocation resolveCEnumeration(CEnumeration binding, ISourceLocation origin) throws URISyntaxException {
Expand Down

0 comments on commit 6ef007d

Please sign in to comment.