public override object InvokeMember(Func <object> proceed, object self, string name, INamedEnumerable <object> args) { if (name == "Supertype") { if (args.Count() == 0) { return(_superType); } if (args.Positional.Count() == 1) { var param = args.Positional.First(); if (param is Type) { _superType = ((Type)param).Name; } else { _superType = param.ToString(); } return(self); } } if (name == "Stereotype") { if (args.Count() == 0) { return(_stereoType); } if (args.Positional.Count() == 1) { var param = args.Positional.First(); if (param is Type) { _stereoType = ((Type)param).Name; } else { _stereoType = param.ToString(); } return(self); } } // TODO: Slow lookup, convert to a dict // Converts to Array supertype if we use any of the array manipulation methods if (_arrayMethods.Contains(name)) { dynamic dself = self; dself.Supertype("Array"); } 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()); }
public override object InvokeMember(Func <object> proceed, dynamic self, string name, INamedEnumerable <object> args) { if (args.Count() == 1 && args.Named.Count() == 0) { Patch(self, name, args.Single()); } return(proceed()); }
public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) { if (name == "Supertype") { if (args.Count() == 0) { return _superType; } if (args.Positional.Count()==1) { var param = args.Positional.First(); if (param is Type) { _superType = ((Type)param).Name; } else { _superType = param.ToString(); } return self; } } if (name == "Stereotype") { if (args.Count() == 0) { return _stereoType; } if (args.Positional.Count() == 1) { var param = args.Positional.First(); if (param is Type) { _stereoType = ((Type)param).Name; } else { _stereoType = param.ToString(); } return self; } } // TODO: Slow lookup, convert to a dict // Converts to Array supertype if we use any of the array manipulation methods if (_arrayMethods.Contains(name)) { dynamic dself = self; dself.Supertype("Array"); } 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(); }
public override object InvokeMemberMissing(Func <object> proceed, object self, string name, INamedEnumerable <object> args) { if (!args.Any()) { return(GetMemberMissing(proceed, self, name)); } if (args.Count() == 1) { SetMemberMissing(proceed, self, name, args.Single()); 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()); }
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(); }
public override object InvokeMember(Func <object> proceed, object self, string name, INamedEnumerable <object> args) { return(string.Format("[name:{0}] [count:{1}]", name ?? "<null>", args.Count())); }
public override object InvokeMember(Func<object> proceed, dynamic self, string name, INamedEnumerable<object> args) { if (args.Count() == 1 && args.Named.Count() == 0) Patch(self, name, args.Single()); return proceed(); }
public override object InvokeMember(Func<object> proceed, object self, string name, INamedEnumerable<object> args) { return string.Format("[name:{0}] [count:{1}]", name ?? "<null>", args.Count()); }