feat(parser): Implement C/C++ update_definition

This commit is contained in:
2026-05-05 19:44:40 -04:00
parent 98551a14d9
commit 8642d894df
2 changed files with 106 additions and 0 deletions
+20
View File
@@ -305,3 +305,23 @@ public:
assert 'void normalMethod()' in sig2
assert '{' not in sig2
def test_ast_parser_update_definition_cpp() -> None:
"""Verify update_definition for C++ including scoped methods."""
parser = ASTParser(language="cpp")
code = """
class MyClass {
public:
void myMethod() {
int x = 1;
}
};
"""
new_method = """ void myMethod() {
int y = 2;
}"""
updated = parser.update_definition(code, "MyClass::myMethod", new_method)
assert 'void myMethod() {' in updated
assert 'int y = 2;' in updated
assert 'int x = 1;' not in updated
assert 'class MyClass {' in updated