Community
Participate
Working Groups
not sure if it's a bug: method LocalTypeDeclaraion::traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) calls visitor.visit(this, blockScope) however, this does not call visit(LocalTypeDeclaration, MethodScope) on the visitor (as i expected) - exactly because the best match for the call is visit(TypeDeclaration, BlockScope) not sure if it's clear what i mean: 'this' is statically resolved to LocalTypeDeclaration so i thought the visit method should be called for LocalTypeDeclaration. the problem is a missing instanceof check on the blockScope - it is is instanceof MethodScope then another method should be called. am i correct that it is a bug?
You are right. The visit(LocalTypeDeclaration, MethodScope) should be called in the traverse. We can either add a cast or change the Visitor API to use BlockScope instead of MethodScope.
Changing the call to add the cast breaks a test in the SearchTests. I asked Jérôme to have a look at it. It might be a bug in the MatchLocatorParser due to the wrong call in the traverse. Jérôme, could you please annotate this PR when you check the MatchLocatorParser implementation?
I think the problem is more with the indexing. Looking at SourceElementParser.LocalDeclarationVistor, I see that it redefines 3 visit methods, none of them taking a MethodScope in its parameter.
Changes released in HEAD. Please ensure that code using the visitor is released as well in the next integration build. It should be done according to your email.