Closed BitPuffin closed 8 years ago
This appears to be caused by BindAndApplyAttributes.OnBlock()
:
override public void OnBlock(Block node)
{
// No need to visit blocks
}
This prevents the visitor from recursing into the body of A
, visiting the BlockExpression
inside of it, and applying the attribute on its arguments. So apparently there is a need after all. :)
After removing that, this specific case still fails due to the following code in RequiredAttribute
:
private def TargetMethod(parameter as ParameterDeclaration):
method = parameter.ParentNode as Method
return method if method is not null
property = parameter.ParentNode as Property
CheckProperty property
return property.Setter
private def CheckProperty(property as Property):
if property is null or property.Setter is null:
InvalidNodeForAttribute('ParameterDeclaration or Property')
This attribute expects to be placed on a ParameterDeclaration
for a Method
, or on a Property
for which it can extract a Setter Method
. It doesn't know how to deal with a ParameterDeclaration
on a BlockExpression
.
What it actually needs, though, is not a Method
, but the Block
that represents the method's body. Fixing this too.
Found that the same problem exists on DefaultAttribute
. Fixing it there as well.
Awesome, nice work. I was considering looking into it myself as it seemed like a pretty approachable bug. But thanks for saving me the trouble! :)