Skip to content

Commit

Permalink
ir: When something has a definition, return unresolved type reference…
Browse files Browse the repository at this point in the history
…s until we parse it.

This ensures that we see all the relevant types that are defined when parsing
the definition, avoiding problems like #888.

Fixes #888
  • Loading branch information
emilio committed Sep 4, 2017
1 parent 28de37e commit bf9b3e9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/ir/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,18 @@ impl ClangItemParser for Item {
// Types are sort of special, so to avoid parsing template classes
// twice, handle them separately.
{
let applicable_cursor = cursor.definition().unwrap_or(cursor);
let definition = cursor.definition();
let applicable_cursor = definition.unwrap_or(cursor);

if definition.is_some() && definition != Some(cursor) {
return Ok(Item::from_ty_or_ref(
applicable_cursor.cur_type(),
cursor,
parent_id,
ctx,
));
}

match Item::from_ty(
&applicable_cursor.cur_type(),
applicable_cursor,
Expand Down

0 comments on commit bf9b3e9

Please sign in to comment.