validateAttributeAccess validates that all attributes in attr exist in obj
(m *MethodExpr, source string, verr *eval.ValidationErrors, target *AttributeExpr, attr *AttributeExpr)
| 145 | |
| 146 | // validateAttributeAccess validates that all attributes in attr exist in obj |
| 147 | func (i *InterceptorExpr) validateAttributeAccess(m *MethodExpr, source string, verr *eval.ValidationErrors, target *AttributeExpr, attr *AttributeExpr) { |
| 148 | attrObj := AsObject(attr.Type) |
| 149 | if attrObj == nil { |
| 150 | verr.Add(m, "interceptor %q %s attribute is not an object", i.Name, source) |
| 151 | return |
| 152 | } |
| 153 | for _, att := range *attrObj { |
| 154 | if target.Find(att.Name) == nil { |
| 155 | verr.Add(m, "interceptor %q cannot %s attribute %q: attribute does not exist", i.Name, source, att.Name) |
| 156 | } |
| 157 | } |
| 158 | } |