Exemplo n.º 1
0
        private static void VerifyMixinVariableReferences(List <string> globals, MixinBlock mixin)
        {
            var locallyDeclared = new List <string>();

            locallyDeclared.AddRange(mixin.Parameters.Select(s => s.Name));

            if (mixin.Parameters.Count() > 0)
            {
                locallyDeclared.Add("arguments");
            }

            var outer = new List <string>();

            outer.AddRange(globals);
            outer.AddRange(locallyDeclared);

            VerifyBlockVariableReferences(outer, mixin.Properties);
        }
Exemplo n.º 2
0
        /// <summary>
        /// selector : (s select element s)+ arguments? ;
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private IEnumerable<ElementBlock> Selector(LessPegNode node)
        {
            var enumerator = node.Children().GetEnumerator();
            while(enumerator.MoveNext())
            {
                ElementBlock block;

                var selector = enumerator.Current.GetAsString(Src).Trim();
                enumerator.MoveNext();
                var name = enumerator.Current.GetAsString(Src);

                var next = enumerator.Current.Next;
                var isMixinWithArgs = next != null && next.Type() == EnLess.arguments;

                if (isMixinWithArgs)
                {
                    var mixinBlock = new MixinBlock(name, selector);
                    block = mixinBlock;

                    var arguments = GetMixinArguments(next, block);
                    enumerator.MoveNext();

                    foreach (var argument in arguments)
                        mixinBlock.Arguments.Add(argument);
                }
                else
                    block = new ElementBlock(name, selector);

                yield return block;
            }
        }