public override void OnAttribute(Boo.Lang.Ast.Attribute attribute, ref Boo.Lang.Ast.Attribute resultingNode) { // Neste primeiro passo tentamos apenas // resolver ast attributes. // Um passo posterior (resoluo de nomes e tipos) ir // assegurar que todos os nomes tenham sido resolvidos e colocar // mensagens de erro de acordo IBinding binding = ResolveQualifiedName(attribute, attribute.Name); if (null == binding) { binding = ResolveQualifiedName(attribute, BuildAttributeName(attribute.Name)); } if (null != binding) { if (BindingType.Ambiguous == binding.BindingType) { Errors.AmbiguousName(attribute, attribute.Name, ((AmbiguousBinding)binding).Bindings); } else { if (BindingType.TypeReference != binding.BindingType) { Errors.NameNotType(attribute, attribute.Name); } else { ITypeBinding attributeType = ((ITypedBinding)binding).BoundType; if (IsAstAttribute(attributeType)) { ExternalTypeBinding externalType = attributeType as ExternalTypeBinding; if (null == externalType) { Errors.AstAttributeMustBeExternal(attribute, attributeType); } else { ScheduleAttributeApplication(attribute, externalType.Type); // remove it from parent resultingNode = null; } } else { if (!IsSystemAttribute(attributeType)) { Errors.TypeNotAttribute(attribute, attributeType.FullName); } else { // remember the attribute's type BindingManager.Bind(attribute, attributeType); } } } } } }
public void AstAttributeMustBeExternal(Boo.Lang.Ast.Attribute attribute, Bindings.ITypeBinding resolvedType) { Add(new Error(attribute, Format("AstAttributeMustBeExternal", resolvedType.FullName))); }
public void AttributeResolution(Boo.Lang.Ast.Attribute attribute, Type type, Exception cause) { string msg = Format("AttributeResolution", type, cause.Message); Add(new Error(attribute, msg, cause)); }
public ApplyAttributeTask(CompilerContext context, Boo.Lang.Ast.Attribute attribute, Type type) { _context = context; _attribute = attribute; _type = type; }
void ScheduleAttributeApplication(Boo.Lang.Ast.Attribute attribute, Type type) { _tasks.Add(new ApplyAttributeTask(_context, attribute, type)); }