Skip to content

visit_children with :recurse doesn't visit every child #35

@camertron

Description

@camertron

I must be missing something. Using the code example in the readme on a small snippet of C++ code doesn't print anything, and trying on a larger code sample only prints a very small subset of the nodes in the AST. Here's the small chunk of C++ code I'm trying to parse:

ofPtr< ABTest > ABTest::create()
{
  ofPtr< ABTest > create( new ABTest() );
  create->init( create, ABTest::getValueStoreType() );
  if (create->_this)
  {
    return create;
  }
  return ofPtr< ABTest >();
}

Here's the ruby code that's trying to parse it:

require 'ffi/clang'

include FFI::Clang

index = Index.new(false)
translation_unit = index.parse_translation_unit("/Users/cameron/Desktop/test.cpp")
cursor = translation_unit.cursor

cursor.visit_children do |cursor, parent|
  puts "#{cursor.kind} #{cursor.spelling.inspect}"
  next :recurse
end

This code prints nothing. Is it possible next :recurse isn't working for some reason? Thanks for your help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions