mirror of
https://github.com/github/codeql.git
synced 2026-01-04 10:10:20 +01:00
raise syntax error on declaration of private method, and add syntax tests for private fields
This commit is contained in:
@@ -3238,6 +3238,9 @@ public class Parser {
|
||||
if (pi.kind.equals("set") && node.getValue().hasRest())
|
||||
this.raiseRecoverable(params.get(params.size() - 1), "Setter cannot use rest params");
|
||||
}
|
||||
if (pi.key instanceof Identifier && ((Identifier)pi.key).getName().startsWith("#")) {
|
||||
raiseRecoverable(pi.key, "Only fields, not methods, can be declared private.");
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user