/// <summary> /// Evaluate the result of indexing an object e.g. users[0] or users["admins"] /// </summary> /// <param name="regmethods"></param> /// <param name="node"></param> /// <param name="target"></param> /// <param name="ndxObj"></param> /// <returns></returns> public static LObject AccessIndex(RegisteredMethods regmethods, AstNode node, LObject target, LObject ndxObj) { object result = LObjects.Null; // Case 1: Array access users[0]; if (target.Type == LTypes.Array) { var ndx = ((LNumber)ndxObj).Value; var methods = regmethods.Get(LTypes.Array); // TODO: Make this generic. var length = Convert.ToInt32(methods.ExecuteMethod(target, "length", null)); if(ndx >= length) throw ExceptionHelper.BuildRunTimeException(node, "Index out of bounds : '" + ndx + "'"); result = methods.GetByNumericIndex(target, (int)ndx); } // Case 2: Map access. users["kishore"]; else if (target.Type == LTypes.Map) { var memberName = ((LString)ndxObj).Value; var methods = regmethods.Get(LTypes.Map); if (!methods.HasProperty(target, memberName)) throw ExceptionHelper.BuildRunTimeException(node, "Property does not exist : '" + memberName + "'"); result = methods.GetByStringMember(target, memberName); } // Conver to lang type. if(result != LObjects.Null && !(result is LObject)) { result = LangTypeHelper.ConvertToLangValue(result); } return (LObject)result; }
public static void ResetSymbolAsFunction(ISymbols symscope, string varname, LObject lobj) { // 1. Define the function in global symbol scope var lambda = lobj as LFunction; var funcExpr = lambda.Value as FunctionExpr; var symbol = new SymbolFunction(funcExpr.Meta); symbol.Name = varname; symbol.FuncExpr = funcExpr; symscope.Define(symbol); }
public static LNumber ConverToLangDayOfWeekNumber(LObject obj) { if (obj.Type == LTypes.Date) { var day = (int)((LDate) obj).Value.DayOfWeek; return new LNumber(day); } if (obj.Type == LTypes.DayOfWeek) { var day = (int)((LDayOfWeek)obj).Value; return new LNumber(day); } return (LNumber)obj; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="arrays">Array of arrays to add</param> /// <returns>A copy of joined array</returns> public LObject Concat(LObject target, params object[] arrays) { if (arrays == null || arrays.Length == 0) return target; var list = target.GetValue() as IList; var copy = new List<object>(); AddRange(copy, list); for (var ndx = 0; ndx < arrays.Length; ndx++) { object item = arrays[ndx]; IList array = (IList)item; AddRange(copy, array); } return new LArray(copy); }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="item">The item to search for</param> /// <param name="start">The starting position of the search.</param> /// <returns>A copy of joined array</returns> public int LastIndexOf(LObject target, object item, int start) { var list = target.GetValue() as IList; var foundPos = -1; var total = list.Count; for (var ndx = start; ndx < total; ndx++) { var itemAt = list[ndx] as LObject; if (itemAt != null && itemAt.GetValue() == item) { foundPos = ndx; } } return(foundPos); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="member">The name of the map key/property to get</param> /// <returns></returns> public override object GetByStringMember(LObject target, string member) { if (target == null) { return(LObjects.Null); } var map = target.GetValue() as IDictionary; if (map == null || map.Count == 0) { return(LObjects.Null); } if (string.IsNullOrEmpty(member)) { throw new IndexOutOfRangeException("Property does not exist : " + member); } return(map[member]); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="member">The name of the map key/property to set</param> /// <param name="value">The vlaue to set</param> /// <returns></returns> public override void SetByStringMember(LObject obj, string member, LObject val) { if (obj == null) { return; } var map = obj.GetValue() as IDictionary; if (map == null) { return; } if (string.IsNullOrEmpty(member)) { throw new IndexOutOfRangeException("Property does not exist : " + member); } map[member] = val; }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) { return(0); } // Add var list = target.GetValue() as IList; foreach (object elem in elements) { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } return(list.Count); }
/// <summary> /// Adds new elements to the beginning of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add.</param> /// <returns>The new length</returns> public int UnShift(LObject target, params object[] elements) { var list = target.GetValue() as IList; if (list == null) { return(0); } if (elements == null || elements.Length == 0) { return(list.Count); } for (var ndx = 0; ndx < elements.Length; ndx++) { object val = elements[ndx]; list.Insert(0, val); } return(list.Count); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public override void SetByNumericIndex(LObject target, int index, LObject val) { if (target == null) { return; } var list = target.GetValue() as IList; if (list == null || list.Count == 0) { return; } if (index < 0 || index >= list.Count) { throw new IndexOutOfRangeException("Index : " + index); } list[index] = val; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="arrays">Array of arrays to add</param> /// <returns>A copy of joined array</returns> public LObject Concat(LObject target, params object[] arrays) { if (arrays == null || arrays.Length == 0) { return(target); } var list = target.GetValue() as IList; var copy = new List <object>(); AddRange(copy, list); for (var ndx = 0; ndx < arrays.Length; ndx++) { object item = arrays[ndx]; IList array = (IList)item; AddRange(copy, array); } return(new LArray(copy)); }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) { return(0); } // Add var list = target.GetValue() as IList; if (list == null) { return(0); } foreach (object elem in elements) { if (list.GetType().IsGenericType) { var gt = list.GetType().GetGenericArguments()[0]; if (gt != null && gt.FullName.StartsWith("ComLib.Lang")) { var langVal = LangTypeHelper.ConvertToLangValue(elem); list.Add(langVal); } else { list.Add(elem); } } else { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } } return(list.Count); }
/// <summary> /// Gets a see MemberAccess object that represents the instance, member name and other information on the member access expression. /// </summary> /// <param name="node">The Ast node associated with the member access operation</param> /// <param name="methods">The collection of registered methods on various types</param> /// <param name="obj">The object on which the member access is being performed.</param> /// <param name="memberName">The name of the member to get.</param> /// <returns></returns> public static MemberAccess GetLangBasicTypeMember(AstNode node, RegisteredMethods methods, LObject obj, string memberName) { var type = obj.Type; // Get the methods implementation LTypeMethods for this basic type // e.g. string, date, time, array , map // e.g. LStringType LDateType, LTimeType, LArrayType, LMapType var typeMethods = methods.Get(type); // 1. Check that the member exists. if (!typeMethods.HasMember(obj, memberName)) throw ExceptionHelper.BuildRunTimeException(node, "Property or Member : " + memberName + " does not exist"); // 2. It's either a Property or method var isProp = typeMethods.HasProperty(obj, memberName); var mode = isProp ? MemberMode.PropertyMember : MemberMode.MethodMember; var maccess = new MemberAccess(mode); maccess.Name = type.Name; maccess.Instance = obj; maccess.MemberName = memberName; maccess.Type = type; return maccess; }
/// <summary> /// Adds/Removes elements from an array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index">The index position to add/remove</param> /// <param name="howmany">How many elements to remove, if 0 no elements are removed</param> /// <param name="elements">Optional: The elements to add</param> /// <returns></returns> public LObject Splice(LObject target, int index, int howmany, params object[] elements) { var list = target.GetValue() as IList; List<object> removed = null; if (howmany > 0) { removed = new List<object>(); for (int ndxRemove = index; ndxRemove < (index + howmany); ndxRemove++) { removed.Add(list[ndxRemove]); } RemoveRange(list, index, howmany); } if (elements != null && elements.Length > 0 ) { var lastIndex = index; for (var ndx = 0; ndx < elements.Length; ndx++) { object objToAdd = elements[ndx]; list.Insert(lastIndex, objToAdd); lastIndex++; } } return new LArray(removed); }
/// <summary> /// Removes the first element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The first element</returns> public object Shift(LObject target) { var list = target.GetValue() as IList; if (list.Count == 0) return null; object item = list[0]; list.RemoveAt(0); return item; }
/// <summary> /// Reverses the order of the elements in an array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns></returns> public LObject Reverse(LObject target) { var list = target.GetValue() as IList; int length = list.Count; if (length == 0 || length == 1) return null; // 2 or more. int highIndex = length - 1; int stopIndex = length / 2; if (length % 2 == 0) stopIndex--; for (int lowIndex = 0; lowIndex <= stopIndex; lowIndex++) { object tmp = list[lowIndex]; list[lowIndex] = list[highIndex]; list[highIndex] = tmp; highIndex--; } return target; }
/// <summary> /// Removes the last element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The removed element</returns> public object Pop(LObject target) { var list = target.GetValue() as IList; var index = list.Count - 1; object toRemove = list[index]; list.RemoveAt(index); return toRemove; }
/// <summary> /// Joins two or more arrays, and returns a copy of the joined arrays /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="item">The item to search for</param> /// <param name="start">The starting position of the search.</param> /// <returns>A copy of joined array</returns> public int LastIndexOf(LObject target, object item, int start) { var list = target.GetValue() as IList; var foundPos = -1; var total = list.Count; for(var ndx = start; ndx < total; ndx++) { var itemAt = list[ndx] as LObject; if (itemAt != null && itemAt.GetValue() == item) { foundPos = ndx; } } return foundPos; }
/// <summary> /// Removes the last element of an array, and returns that element /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <returns>The removed element</returns> public object Pop(LObject target) { return(this.RemoveLast(target)); }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied property. /// </summary> /// <param name="obj">The data obj to check for the property</param> /// <param name="propertyName">The name of the property</param> /// <returns></returns> public virtual bool HasProperty(LObject obj, string propertyName) { if (!_allMembersMap.ContainsKey(propertyName)) return false; var member = _allMembersMap[propertyName]; return member == MemberTypes.Property; }
/// <summary> /// Evaluates a math expression of 2 time spans. /// </summary> /// <param name="node">The AST node the evaluation is a part of.</param> /// <param name="lhs">The time on the left hand side</param> /// <param name="rhs">The time on the right hand side</param> /// <param name="op">The math operator.</param> /// <returns></returns> public static LBool CompareDays(AstNode node, LObject lhs, LObject rhs, Operator op) { var left = LangTypeHelper.ConverToLangDayOfWeekNumber(lhs); var right = LangTypeHelper.ConverToLangDayOfWeekNumber(rhs); var res = CompareNumbers(node, left, right, op); return res; }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied member. /// </summary> /// <param name="obj">The data obj to check for the member</param> /// <param name="memberName">The name of the member to check for.</param> /// <returns></returns> public virtual bool HasMember(LObject obj, string memberName) { return(_allMembersMap.ContainsKey(memberName)); }
/// <summary> /// Executes the method supplied on the the type. /// </summary> /// <param name="obj">The language type</param> /// <param name="methodName">The method name</param> /// <param name="parameters">The parameters to the method.</param> /// <returns></returns> public virtual object ExecuteMethod(LObject obj, string methodName, object[] parameters) { var mappedMethod = _methodMap[methodName]; var args = new ArgsFetcher(parameters); // total required = var funcDef = mappedMethod.FuncDef; int total = funcDef.GetTotalRequiredArgs(); var methodArgs = new List <object>(); var hasParams = parameters != null && parameters.Length > 0; methodArgs.Add(obj); // TODO: Figure out the total required args when AddArg is called. if (total > 0 && hasParams) { var ndx = 0; var totalParamsGiven = parameters.Length; // Go through all the argument definitions. foreach (var arg in funcDef.Arguments) { var isRequired = arg.Required; // 1. Required and provided? if (isRequired && ndx < parameters.Length) { // Positional arg. if (arg.Type != "params") { var param = parameters[ndx]; var val = ConvertToProperType(arg, param); methodArgs.Add(val); } // End of list arguments. else { var remainder = new List <object>(); while (ndx < totalParamsGiven) { var param = parameters[ndx]; var val = ConvertToProperType(arg, param); remainder.Add(val); ndx++; } methodArgs.Add(remainder.ToArray()); } } // 2. Not required but supplied. else if (!isRequired && ndx < parameters.Length) { var param = parameters[ndx]; var val = ConvertToProperType(arg, param); methodArgs.Add(val); } // 3. Not required but there is a default. else if (!isRequired && arg.DefaultValue != null && ndx >= parameters.Length) { methodArgs.Add(arg.DefaultValue); } // 4. Not required and extra params else if (!isRequired && arg.DefaultValue == null && arg.Name == "params" && ndx >= parameters.Length) { methodArgs.Add(null); } ndx++; } } else if (hasParams) { for (var ndx = 0; ndx < parameters.Length; ndx++) { var val = ((LObject)parameters[ndx]).GetValue(); methodArgs.Add(val); } } var methodParams = methodArgs.ToArray(); var method = this.GetType().GetMethod(mappedMethod.HostLanguageMethod); object result = method.Invoke(this, methodParams); return(result); }
/// <summary> /// Set a value by the index. /// </summary> /// <param name="obj"></param> /// <param name="ndx"></param> public virtual void SetByStringMember(LObject obj, string member, LObject val) { }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="obj">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public virtual void SetByNumericIndex(LObject obj, int index, LObject val) { }
/// <summary> /// Set a value by the index. /// </summary> /// <param name="obj"></param> /// <param name="ndx"></param> public virtual void SetByStringMember(LObject obj, string member, LObject val) { }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) return 0; // Add var list = target.GetValue() as IList; foreach (object elem in elements) { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } return list.Count; }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public int Length(LObject target) { var list = target.GetValue() as IList; return(list.Count); }
/// <summary> /// Is match with the type supplied and the /// </summary> /// <param name="type"></param> /// <param name="obj1"></param> /// <param name="obj2"></param> /// <returns></returns> private static bool IsTypeMatch(LType type, LObject obj1, LObject obj2) { if (obj1.Type == type && obj2.Type == type) return true; return false; }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index"></param> /// <returns></returns> public virtual object GetByStringMember(LObject target, string member) { return(LObjects.Null); }
/// <summary> /// Creates a variable expression with symbol scope, context, script refernce set. /// </summary> /// <param name="name"></param> /// <returns></returns> public static Expr Const(LObject obj, TokenData token) { var exp = new ConstantExpr(); exp.Value = obj; SetupContext(exp, token); return exp; }
/// <summary> /// Joins all elements of an array into a string /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="separator">The separator to use for joining the elements.</param> /// <returns></returns> public string Join(LObject target, string separator = ",") { var list = target.GetValue() as IList; if (list == null || list.Count == 0) return string.Empty; var buffer = new StringBuilder(); var total = list.Count; var lobj = list[0] as LObject; if (lobj != null) buffer.Append(lobj.GetValue()); if (total > 1) { for (int ndx = 1; ndx < list.Count; ndx++) { lobj = list[ndx] as LObject; buffer.Append(separator + lobj.GetValue()); } } string result = buffer.ToString(); return result; }
/// <summary> /// Creates a variable expression with symbol scope, context, script refernce set. /// </summary> /// <param name="name"></param> /// <returns></returns> public Expr ToConstExpr(LObject obj, TokenData token) { var exp = new ConstantExpr(obj); this.SetupContext(exp, token); return exp; }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public int Length(LObject target) { var list = target.GetValue() as IList; return list.Count; }
/// <summary> /// Check if the expression is true. /// </summary> /// <param name="result"></param> /// <returns></returns> public static bool IsTrue(LObject result) { if (result == null || result == LObjects.Null) return false; if (result.Type == LTypes.Number) { var num = (LNumber) result; return num.Value > 0; } if (result.Type == LTypes.String) { var str = (LString)result; return str.Value != null; } if (result.Type == LTypes.Bool) { var bl = (LBool) result; return bl.Value; } if ( result.Type == LTypes.Date) { var dt = (LDate) result; return dt.Value != DateTime.MinValue && dt.Value != DateTime.MaxValue; } return true; }
/// <summary> /// Adds new elements to the end of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add</param> /// <returns>The new length</returns> public int Push(LObject target, params object[] elements) { if (elements == null || elements.Length == 0) return 0; // Add var list = target.GetValue() as IList; if (list == null) return 0; foreach (object elem in elements) { if(list.GetType().IsGenericType) { var gt = list.GetType().GetGenericArguments()[0]; if(gt != null && gt.FullName.StartsWith("ComLib.Lang")) { var langVal = LangTypeHelper.ConvertToLangValue(elem); list.Add(langVal); } else { list.Add(elem); } } else { var langType = LangTypeHelper.ConvertToLangValue(elem); list.Add(langType); } } return list.Count; }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied method. /// </summary> /// <param name="obj">The data obj to check for the method</param> /// <param name="methodName">The name of the method to check for.</param> /// <returns></returns> public virtual bool HasMethod(LObject obj, string methodName) { if (!_allMembersMap.ContainsKey(methodName)) return false; var member = _allMembersMap[methodName]; return member == MemberTypes.Method; }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public override void SetByNumericIndex(LObject target, int index, LObject val) { if (target == null) return; var list = target.GetValue() as IList; if (list == null || list.Count == 0) return; if (index < 0 || index >= list.Count) throw new IndexOutOfRangeException("Index : " + index); list[index] = val; }
/// <summary> /// Gets the property value for the specified propertyname. /// </summary> /// <param name="target">The object containing the property</param> /// <param name="propName">The name of the property</param> /// <returns></returns> public override object GetProperty(LObject target, string propName) { var map = target.GetValue() as IDictionary; return(map[propName]); }
/// <summary> /// Selects a part of an array, and returns the new array /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="start">The start of the selection</param> /// <param name="end">The end of the selection, if not supplied, selects all elements from start to end of the array</param> /// <returns>A new array</returns> public LObject Slice(LObject target, int start, int end) { var list = target.GetValue() as IList; var items = new List<object>(); if (end == -1) end = list.Count; for (var ndx = start; ndx < end; ndx++) items.Add(list[ndx]); return new LArray(items); }
/// <summary> /// Sets the property value for the specified propertyname. /// </summary> /// <param name="target">The object to set the property value on</param> /// <param name="propName">The name of the property</param> /// <param name="val">The value to set on the property</param> /// <returns></returns> public override void SetProperty(LObject target, string propName, object val) { var map = target.GetValue() as IDictionary; map[propName] = val; }
/// <summary> /// Adds new elements to the beginning of an array, and returns the new length /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="elements">The elements to add.</param> /// <returns>The new length</returns> public int UnShift(LObject target, params object[] elements) { var list = target.GetValue() as IList; if (list == null) return 0; if (elements == null || elements.Length == 0) return list.Count; for (var ndx = 0; ndx < elements.Length; ndx++) { object val = elements[ndx]; list.Insert(0, val); } return list.Count; }
/// <summary> /// Lenght of the array. /// </summary> /// <param name="target">The target list to apply this method on.</param> public int Length(LObject target) { var map = target.GetValue() as IDictionary; return(map.Count); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index"></param> /// <returns></returns> public override object GetByNumericIndex(LObject target, int index) { if (target == null) return LObjects.Null; var list = target.GetValue() as IList; if (list == null || list.Count == 0) return LObjects.Null; if (index < 0 || index >= list.Count) throw new IndexOutOfRangeException("Index : " + index); return list[index]; }
/// <summary> /// Validates the method call. /// </summary> /// <param name="obj"></param> /// <param name="methodName"></param> /// <param name="parameters"></param> /// <returns></returns> public virtual ComLib.Lang.Core.BoolMsgObj ValidateCall(LObject obj, string methodName, object[] parameters) { // 1. Valid method/member name? if (!this._methodMap.ContainsKey(methodName)) return new BoolMsgObj(obj, false, "The method name : " + methodName + " does not exist for this type"); // 2. Valid method parameters? var mappedMethod = _methodMap[methodName]; var funcDef = mappedMethod.FuncDef; var ndx = 0; var isValid = true; var message = string.Empty; foreach (var arg in funcDef.Arguments) { if (arg.Required && ndx >= parameters.Length) { isValid = false; message = "Required argument : " + arg.Name + " was not supplied"; break; } var param = parameters[ndx]; ndx++; } return new BoolMsgObj(obj, isValid, message); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="obj">The object whose index value is being set.</param> /// <param name="index">The index position to set the value</param> /// <param name="val">The value to set at the index</param> /// <returns></returns> public virtual void SetByNumericIndex(LObject obj, int index, LObject val) { }
/// <summary> /// Sets the property value for the specified propertyname. /// </summary> /// <param name="obj">The object to set the property value on</param> /// <param name="propName">The name of the property</param> /// <param name="val">The value to set on the property</param> /// <returns></returns> public virtual void SetProperty(LObject obj, string propName, object val) { var mappedMethod = _methodMap[propName]; // total required = var funcDef = mappedMethod.FuncDef; int total = funcDef.GetTotalRequiredArgs(); var methodArgs = new[] {obj, val}; var method = this.GetType().GetMethod(mappedMethod.HostLanguageMethod); object result = method.Invoke(this, methodArgs); }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied member. /// </summary> /// <param name="obj">The data obj to check for the member</param> /// <param name="memberName">The name of the member to check for.</param> /// <returns></returns> public override bool HasMember(LObject obj, string memberName) { return(HasProperty(obj, memberName)); }
/// <summary> /// Get / set value by index. /// </summary> /// <param name="target">The target list to apply this method on.</param> /// <param name="index"></param> /// <returns></returns> public virtual object GetByNumericIndex(LObject target, int index) { return(LObjects.Null); }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied method. /// </summary> /// <param name="obj">The data obj to check for the method</param> /// <param name="methodName">The name of the method to check for.</param> /// <returns></returns> public override bool HasMethod(LObject obj, string methodName) { return(HasProperty(obj, methodName)); }
/// <summary> /// Whether or not the associted obj of this methods class has the supplied member. /// </summary> /// <param name="obj">The data obj to check for the member</param> /// <param name="memberName">The name of the member to check for.</param> /// <returns></returns> public virtual bool HasMember(LObject obj, string memberName) { return _allMembersMap.ContainsKey(memberName); }