Check if the given line is a constructor. Args: line: Line to check. class_name: If line checked is inside of a class block, a str of the class's name; otherwise, None.
(self, line: str, linenum: int, class_name: str | None = None)
| 3522 | return line |
| 3523 | |
| 3524 | def _UpdateConstructor(self, line: str, linenum: int, class_name: str | None = None): |
| 3525 | """ |
| 3526 | Check if the given line is a constructor. |
| 3527 | Args: |
| 3528 | line: Line to check. |
| 3529 | class_name: If line checked is inside of a class block, a str of the class's name; |
| 3530 | otherwise, None. |
| 3531 | """ |
| 3532 | if not class_name: |
| 3533 | if not re.match(r"\s*(\w*)\s*::\s*\1\s*\(", line): |
| 3534 | return |
| 3535 | elif not re.match(rf"\s*{re.escape(class_name)}\s*\(", line): |
| 3536 | return |
| 3537 | |
| 3538 | self.stack.append(_ConstructorInfo(linenum)) |
| 3539 | |
| 3540 | # TODO(google): Update() is too long, but we will refactor later. |
| 3541 | def Update(self, filename: str, clean_lines: CleansedLines, linenum: int, error): |
no test coverage detected