private bool BuildConfigurationNode(BinaryExpression node, bool asAttribute,
                                            HashLiteralExpression configuration)
        {
            var nodeVisitor = new ConfigurationNodeVisitor();

            if (!nodeVisitor.GetNode(node.Left, asAttribute, _compileErrors))
            {
                return(false);
            }

            if (nodeVisitor.IsAttribute || asAttribute)
            {
                return(BuildConfigurationAttribute(nodeVisitor.Node, node.Right, configuration));
            }

            if ((_skip = _attributesOnly) == false)
            {
                return(BuildConfigurationChild(nodeVisitor.Node, node.Right));
            }

            return(true);
        }
Exemple #2
0
        private bool BuildConfigurationChild(MethodInvocationExpression child)
        {
            Block                    configBlock;
            List <Expression>        attributes  = new List <Expression>();
            ConfigurationNodeVisitor nodeVisitor = new ConfigurationNodeVisitor();

            if (!nodeVisitor.GetNode(child, _compileErrors))
            {
                return(false);
            }

            if (!MacroHelper.IsNewBlock(child, out configBlock))
            {
                attributes.AddRange(child.Arguments);

                return(BuildConfigurationChild(nodeVisitor.Node, null, attributes));
            }
            else
            {
                if (configBlock.HasStatements)
                {
                    HashConfigurationBuilder nested = new HashConfigurationBuilder();
                    if (nested.BuildConfig(configBlock, _compileErrors) &&
                        nested.HasConfiguration)
                    {
                        _configuration.Items.Add(new ExpressionPair(nodeVisitor.Node,
                                                                    nested.HashConfiguration));
                        return(true);
                    }
                }
                else
                {
                    return(BuildConfigurationChild(nodeVisitor.Node, null, null));
                }
            }

            return(false);
        }
        private bool BuildConfigurationNode(BinaryExpression node, bool asAttribute,
		                                    HashLiteralExpression configuration)
        {
            var nodeVisitor = new ConfigurationNodeVisitor();
            if (!nodeVisitor.GetNode(node.Left, asAttribute, _compileErrors)) return false;

            if (nodeVisitor.IsAttribute || asAttribute)
            {
                return BuildConfigurationAttribute(nodeVisitor.Node, node.Right, configuration);
            }

            if ((_skip =_attributesOnly) == false)
            {
                return BuildConfigurationChild(nodeVisitor.Node, node.Right);
            }

            return true;
        }
        private bool BuildConfigurationChild(MethodInvocationExpression child)
        {
            Block configBlock;
            var attributes = new List<Expression>();
            var nodeVisitor = new ConfigurationNodeVisitor();
            if (nodeVisitor.GetNode(child, _compileErrors) == false)
                return false;

            if (MacroHelper.IsNewBlock(child, out configBlock) == false)
            {
                attributes.AddRange(child.Arguments);

                return BuildConfigurationChild(nodeVisitor.Node, null, attributes);
            }
            else
            {
                if (configBlock.IsEmpty == false)
                {
                    var nested = new HashConfigurationBuilder();
                    if (nested.BuildConfig(configBlock, _compileErrors) &&
                        nested.HasConfiguration)
                    {
                        _configuration.Items.Add(new ExpressionPair(nodeVisitor.Node, nested.HashConfiguration));
                        return true;
                    }
                }
                else
                {
                    return BuildConfigurationChild(nodeVisitor.Node, null, null);
                }
            }

            return false;
        }