Bug 183298 - Open Type and SearchEngine can't find specific classes
Summary: Open Type and SearchEngine can't find specific classes
Status: RESOLVED FIXED
Alias: None
Product: DLTK
Classification: Technology
Component: Ruby (show other bugs)
Version: 0.95   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Mikhail Kalugin CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-19 19:31 EDT by Mark Howe CLA
Modified: 2008-05-26 02:49 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Howe CLA 2007-04-19 19:31:04 EDT
I have a couple of use cases here. The first is using the "Open Type" dialog. If I try to find C_Parser which is in rdoc/parsers, Open Type doesn't find it. I can also call try to find it with the SearchEngine progamatically and get the same result. 

There seem to be various classes that the search engine can't find. I can even open the C_Parser in the editor and retry the search and it doesn't find it, even though it is already open. I've noticed this with seemingly random classes. I have a test rails project (boxroom) and I try to open the controller "FolderController" but it doesn't show up in the dialog, but I can find all the other controllers. 

I don't know if these will be reproducable.
Comment 1 Mark Howe CLA 2007-04-20 01:20:06 EDT
It doesn't have anything to do with searching, the parser fails on a specific block of code in folder_controller.rb from the boxroom application. No problem is reported, the only visual indication is in the sript explore it doesn't display any components of folder_controller.rb (ie no class and method subtree). If you open C_Parser in the script explorer it's the same thing. 

Here is the snippet of code from folder_controller.rb which cause this problem
          case field
          when 'create':
            group_permission.can_create = can_do_it
          when 'read':
            group_permission.can_read = can_do_it
          when 'update':
            group_permission.can_update = can_do_it
          when 'delete':
            group_permission.can_delete = can_do_it
          end
Comment 2 Mark Howe CLA 2007-04-20 20:56:57 EDT
Hi got some more information for you. I created a simple test case:
def m(s)
  case s
  when 'create':
    puts 'created'
  end
end
This creates the silent fail. When this is parsed, the RubyASTBuildVisitor.visitWhenNode method doesn't handle the case where RubyArrayExpression is the expressionStatement. 

I tried the following patch and it seems to work but not sure if it's doing everything required :>.

... insert in the list of tests for expressionsStatement.....
  } else if (expressionsStatement instanceof RubyArrayExpression) {
     RubyArrayExpression rae = (RubyArrayExpression)expressionsStatement;
     statement.setExpressions(rae.getStatements());

When this patch is in I can expand FolderController in the script explorer. There are still other classes that don't expand, I'm going to see if I can isolate where they fail (C_Parser doesn't expand with this patch)
Comment 3 Mikhail Kalugin CLA 2007-04-25 08:55:53 EDT
Bugs with parsing code snippets that you provided seems to be already fixed. C_Parser also are found now from Open Type. 

Thank you for a detailed description of the problems.
Comment 4 Andrey Platov CLA 2008-05-26 02:49:46 EDT
bulk change: fixed in 0.95