Jurassic.Library.FunctionInstance.Call C# (CSharp) Method

Call() private method

private Call ( object thisObj ) : object
thisObj object
return object
        public object Call(object thisObj, params object[] arguments)
        {
            return this.CallLateBound(thisObj, arguments);
        }

Usage Example

Exemplo n.º 1
0
        public static ArrayInstance From(ScriptEngine engine, ObjectInstance iterable, FunctionInstance mapFunction, object thisArg)
        {
            var result   = new List <object>();
            var iterator = TypeUtilities.GetIterator(engine, iterable);

            if (iterator != null)
            {
                // Initialize the array from an iterator.
                int index = 0;
                foreach (var item in TypeUtilities.Iterate(engine, iterator))
                {
                    object mappedValue = mapFunction?.Call(thisArg ?? Undefined.Value, item, index) ?? item;
                    result.Add(mappedValue);
                    index++;
                }
            }
            else
            {
                // Initialize the array from an array-like object.
                uint length = ArrayInstance.GetLength(iterable);
                for (int i = 0; i < length; i++)
                {
                    object mappedValue = mapFunction?.Call(thisArg ?? Undefined.Value, iterable[i], i) ?? iterable[i];
                    result.Add(mappedValue);
                }
            }
            return(engine.Array.New(result.ToArray()));
        }
All Usage Examples Of Jurassic.Library.FunctionInstance::Call