// 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));
        }
        // 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));
        }
Example #5
0
 private static bool IsNsThatMatchesSpecialValue(AttributeAssignment assignment)
 {
     return(assignment.Locator.IsNsPrefixDefinition && assignment.Value == CoreTypes.SpecialNamespace);
 }
Example #6
0
        private static DirectiveAssignment ExtractDirectives(AttributeAssignment assignment)
        {
            var xamlDirective = CoreTypes.GetDirective(assignment.Locator.PropertyName);

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