removed regex match in get_method_visibility()
This commit is contained in:
parent
8afcc5ca15
commit
5e74e9f1ff
1 changed files with 11 additions and 16 deletions
|
@ -112,24 +112,19 @@ def get_method_visibility(line:str) -> str:
|
|||
"""
|
||||
Checks if the line is a method declaration and returns its visibility (+, -, or #).
|
||||
"""
|
||||
method_pattern = re.compile(r'^\s*(public|private|protected|\s)*\s*(static|final|\s)*\s*(\w[\w\d]*)\s+(\w[\w\d]*)\s*\(.*\)\s*(?:throws\s+\w[\w\d]*)?\s*{')
|
||||
match = method_pattern.match(line.strip())
|
||||
if match:
|
||||
# Check for the access modifier in the line and return the corresponding symbol
|
||||
access_modifier = line.strip().split(" ")[0]
|
||||
access_modifier = line.strip().split(" ")[0]
|
||||
|
||||
debug_print("FOUND METHOD WITH ACCESS MODIFIER:", access_modifier)
|
||||
debug_print("FOUND METHOD WITH ACCESS MODIFIER:", access_modifier)
|
||||
|
||||
if "public" in access_modifier:
|
||||
return "+"
|
||||
elif "private" in access_modifier:
|
||||
return "-"
|
||||
elif "protected" in access_modifier:
|
||||
return "#"
|
||||
else:
|
||||
# If there's no access modifier, assume package-private (default) -> return '-'
|
||||
return "-"
|
||||
return None # Return None if it's not a method declaration
|
||||
if "public" in access_modifier:
|
||||
return "+"
|
||||
elif "private" in access_modifier:
|
||||
return "-"
|
||||
elif "protected" in access_modifier:
|
||||
return "#"
|
||||
else:
|
||||
# If there's no access modifier, assume package-private (default) -> return '-'
|
||||
return "-"
|
||||
|
||||
|
||||
class JavaClass:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue