Skip to content

Commit e80db56

Browse files
committed
Fix errors with operators overload in c++
1 parent 56c0f67 commit e80db56

9 files changed

Lines changed: 255015 additions & 229966 deletions

File tree

src/function.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ fn dump_span(
4949
stdout: &mut StandardStreamLock,
5050
last: bool,
5151
) -> std::io::Result<()> {
52-
/*if !span.error {
52+
if !span.error {
5353
return Ok(());
54-
}*/
54+
}
5555

5656
let pref = if last { " `- " } else { " |- " };
5757

src/getter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ impl Getter for CppCode {
245245
let typ = node.kind_id();
246246
match typ.into() {
247247
Cpp::FunctionDefinition | Cpp::FunctionDefinition2 | Cpp::FunctionDefinition3 => {
248+
if let Some(op_cast) = node.first_child(|id| Cpp::OperatorCast == id) {
249+
let code = &code[op_cast.start_byte()..op_cast.end_byte()];
250+
return std::str::from_utf8(code).ok();
251+
}
248252
// we're in a function_definition so need to get the declarator
249253
if let Some(declarator) = node.child_by_field_name("declarator") {
250254
if let Some(fd) = declarator.first_occurence(|id| {

0 commit comments

Comments
 (0)