// TODO: Refactor this shit.
        private ProtoXamlInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableXamlMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                member = GetMemberForDottedLocator(rawAttributeAssignment.Locator);
            }
            else
            {
                if (IsNameDirective(rawAttributeAssignment.Locator, containingType))
                {
                    return instructionBuilder.Directive(CoreTypes.Name, rawAttributeAssignment.Value);
                }

                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);
            return instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix);
        }
        private ProtoXamlInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableXamlMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                var ownerName = rawAttributeAssignment.Locator.Owner.PropertyName;
                var ownerPrefix = rawAttributeAssignment.Locator.Owner.Prefix;

                var owner = wiringContext.TypeContext.GetByPrefix(ownerPrefix, ownerName);

                member = owner.GetAttachableMember(rawAttributeAssignment.Locator.PropertyName);
            }
            else
            {
                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);
            return instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix);
        }
        private ProtoXamlInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableXamlMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                var ownerName   = rawAttributeAssignment.Locator.Owner.PropertyName;
                var ownerPrefix = rawAttributeAssignment.Locator.Owner.Prefix;

                var owner = wiringContext.TypeContext.GetByPrefix(ownerPrefix, ownerName);

                member = owner.GetAttachableMember(rawAttributeAssignment.Locator.PropertyName);
            }
            else
            {
                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);

            return(instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix));
        }
Exemplo n.º 4
0
        // TODO: Refactor this shit.
        private ProtoInstruction ConvertAttributeToNode(XamlType containingType, AttributeAssignment rawAttributeAssignment)
        {
            MutableMember member;

            if (rawAttributeAssignment.Locator.IsDotted)
            {
                member = GetMemberForDottedLocator(rawAttributeAssignment.Locator);
            }
            else
            {
                if (IsNameDirective(rawAttributeAssignment.Locator, containingType))
                {
                    return(instructionBuilder.Directive(CoreTypes.Name, rawAttributeAssignment.Value));
                }

                member = containingType.GetMember(rawAttributeAssignment.Locator.PropertyName);
            }

            var namespaceDeclaration = new NamespaceDeclaration(rawAttributeAssignment.Locator.Namespace, rawAttributeAssignment.Locator.Prefix);

            return(instructionBuilder.Attribute(member, rawAttributeAssignment.Value, namespaceDeclaration.Prefix));
        }
Exemplo n.º 5
0
 private static bool IsNsThatMatchesSpecialValue(AttributeAssignment assignment)
 {
     return(assignment.Locator.IsNsPrefixDefinition && assignment.Value == CoreTypes.SpecialNamespace);
 }
Exemplo n.º 6
0
        private static DirectiveAssignment ExtractDirectives(AttributeAssignment assignment)
        {
            var xamlDirective = CoreTypes.GetDirective(assignment.Locator.PropertyName);

            return(new DirectiveAssignment(xamlDirective, assignment.Value));
        }
Exemplo n.º 7
0
 private bool IsDirective(AttributeAssignment attributeAssignment)
 {
     return(attributeAssignment.Locator.Prefix == specialPrefix);
 }
Exemplo n.º 8
0
 private bool IsAttribute(AttributeAssignment assignment)
 {
     return(!IsDirective(assignment) && !IsNamespaceDefinition(assignment));
 }
Exemplo n.º 9
0
 private static bool IsNamespaceDefinition(AttributeAssignment assignment)
 {
     return(assignment.Locator.IsNsPrefixDefinition);
 }
Exemplo n.º 10
0
 private static bool IsNsThatMatchesSpecialValue(AttributeAssignment assignment)
 {
     return assignment.Locator.IsNsPrefixDefinition && assignment.Value == CoreTypes.SpecialNamespace;
 }
Exemplo n.º 11
0
 private bool IsDirective(AttributeAssignment attributeAssignment)
 {
     return attributeAssignment.Locator.Prefix == specialPrefix;
 }
Exemplo n.º 12
0
 private static DirectiveAssignment ExtractDirectives(AttributeAssignment assignment)
 {
     var xamlDirective = CoreTypes.GetDirective(assignment.Locator.PropertyName);
     return new DirectiveAssignment(xamlDirective, assignment.Value);
 }
Exemplo n.º 13
0
 private static bool IsNamespaceDefinition(AttributeAssignment assignment)
 {
     return assignment.Locator.IsNsPrefixDefinition;
 }
Exemplo n.º 14
0
 private bool IsAttribute(AttributeAssignment assignment)
 {
     return !IsDirective(assignment) && !IsNamespaceDefinition(assignment);
 }