Ejemplo n.º 1
0
        private static void BindParameter(Scope scope, Dictionary<string, MixinBlock> mixinReferences, Dictionary<string, Value> boundVariables, MixinParameter @param, Value value)
        {
            if (value is IncludeSelectorValue)
            {
                var toMap = (IncludeSelectorValue)value;
                mixinReferences[@param.Name] = CreateAnonMixin(toMap);

                return;
            }

            if (!(value is FuncValue))
            {
                boundVariables[@param.Name] = value.Bind(scope);
                return;
            }

            var funcVal = value as FuncValue;
            var asMixin = scope.LookupMixin(funcVal.Name);
            if (asMixin == null)
            {
                var val = scope.LookupVariable(funcVal.Name, -1, -1, null);

                if (val is IncludeSelectorValue)
                {
                    var toMap = (IncludeSelectorValue)val;
                    mixinReferences[@param.Name] = CreateAnonMixin(toMap);
                    return;
                }

                boundVariables[@param.Name] = funcVal.Bind(scope);
            }
            else
            {
                mixinReferences[@param.Name] = asMixin;
            }
        }
Ejemplo n.º 2
0
        private static void BindParameter(Scope scope, Dictionary <string, MixinBlock> mixinReferences, Dictionary <string, Value> boundVariables, MixinParameter @param, Value value)
        {
            if (value is IncludeSelectorValue)
            {
                var toMap = (IncludeSelectorValue)value;
                mixinReferences[@param.Name] = CreateAnonMixin(toMap);

                return;
            }

            if (!(value is FuncValue))
            {
                boundVariables[@param.Name] = value.Bind(scope);
                return;
            }

            var funcVal = value as FuncValue;
            var asMixin = scope.LookupMixin(funcVal.Name);

            if (asMixin == null)
            {
                var val = scope.LookupVariable(funcVal.Name, -1, -1, null);

                if (val is IncludeSelectorValue)
                {
                    var toMap = (IncludeSelectorValue)val;
                    mixinReferences[@param.Name] = CreateAnonMixin(toMap);
                    return;
                }

                boundVariables[@param.Name] = funcVal.Bind(scope);
            }
            else
            {
                mixinReferences[@param.Name] = asMixin;
            }
        }