Esempio n. 1
0
        public void AddAttribute(AttributeConstant attribute)
        {
            // Create the attribute vectorif wasn't created.
            if(attributes == null)
                attributes = new List<AttributeConstant> ();

            // Store the attribute.
            attributes.Add(attribute);
        }
Esempio n. 2
0
        public void AddAttribute(AttributeConstant attribute)
        {
            // Create the attribute vectorif wasn't created.
            if (attributes == null)
            {
                attributes = new List <AttributeConstant> ();
            }

            // Store the attribute.
            attributes.Add(attribute);
        }
Esempio n. 3
0
        public override AstNode Visit(AttributeInstance node)
        {
            // Create the attribute constant.
            Class attributeClass = node.GetAttributeClass();
            Method attributeCtor = node.GetAttributeConstructor();
            AttributeConstant attrConstant = new AttributeConstant(attributeClass, attributeCtor);

            // Set the attribute constant as the node value.
            node.SetNodeValue(attrConstant);

            // Store the arguments.
            AstNode arg = node.GetArguments();
            while(arg != null)
            {
                // Vist the argument.
                arg.Accept(this);

                // Add the argument.
                ConstantValue value = (ConstantValue)arg.GetNodeValue();
                AttributeArgument attrArg = (AttributeArgument)arg;
                Variable property = attrArg.GetProperty();
                if(property != null)
                    attrConstant.AddPropertyValue(property, value);
                else
                    attrConstant.AddArgument(value);

                // Check the next argument.
                arg = arg.GetNext();
            }
            return node;
        }