public override object InvokeMember(Func <object> proceed, object self, string name, INamedEnumerable <object> args)
            {
                var argsCount = args.Count();

                if (name == "Add" && (argsCount == 1 || argsCount == 2))
                {
                    // pszmyd: Ignore null shapes
                    if (args.First() == null)
                    {
                        return(_parent);
                    }

                    dynamic parent = _parent;

                    dynamic zone = _zoneFactory();
                    zone.Parent   = _parent;
                    zone.ZoneName = _potentialZoneName;
                    parent[_potentialZoneName] = zone;

                    if (argsCount == 1)
                    {
                        return(zone.Add(args.Single()));
                    }

                    return(zone.Add(args.First(), (string)args.Last()));
                }
                return(proceed());
            }
Beispiel #2
0
 public override object InvokeMember(Func <object> proceed, object self, string name, INamedEnumerable <object> args)
 {
     if (name == "Set")
     {
         if (args.Positional.Count() == 1)
         {
             SetLocal(self, args.First());
             return(self);
         }
     }
     if (name == "Get" && (args.Positional.Count() == 0))
     {
         var type = ((dynamic)self).Supertype();
         if (type == "Null")
         {
             return(null);
         }
         if (type == "Value")
         {
             return(_localValue);
         }
         if (type == "Array")
         {
             return(((IEnumerable <dynamic>)((dynamic)self)).Select(o => o.Get()));
         }
         return(self);
     }
     return(proceed());
 }
 public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) {
     if (name == "Invert") {
         if (args.Count() == 0) {
             Inverted = true;
         }
         else {
             Inverted = (bool)(args.First());
         }
         return null;
     }
     return proceed();
 }
Beispiel #4
0
 public override object InvokeMember(Func <object> proceed, object self, string name, INamedEnumerable <object> args)
 {
     if (name == "Invert")
     {
         if (args.Count() == 0)
         {
             Inverted = true;
         }
         else
         {
             Inverted = (bool)(args.First());
         }
         return(null);
     }
     return(proceed());
 }
            public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) {
                var argsCount = args.Count();
                if (name == "Add" && (argsCount == 1 || argsCount == 2)) {
                    // pszmyd: Ignore null shapes
                    if (args.First() == null)
                        return _parent;

                    dynamic parent = _parent;

                    dynamic zone = _zoneFactory();
                    zone.Parent = _parent;
                    zone.ZoneName = _potentialZoneName;
                    parent[_potentialZoneName] = zone;

                    if (argsCount == 1)
                        return zone.Add(args.Single());

                    return zone.Add(args.First(), (string)args.Last());
                }
                return proceed();
            }
Beispiel #6
0
        public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) {

            if (name == "Set") {
                if (args.Positional.Count() == 1) {
                    SetLocal(self, args.First());
                    return self;
                }
            }
            if (name == "Get" && (args.Positional.Count() == 0)) {
                var type = ((dynamic)self).Supertype();
                if (type == "Null") return null;
                if (type == "Value") return _localValue;
                if (type == "Array") return ((IEnumerable<dynamic>)((dynamic)self)).Select(o => o.Get());
                return self;
            }
            return proceed();
        }