예제 #1
0
        public static EcmaValue DefineProperty(EcmaValue target, EcmaValue property, EcmaValue attributes)
        {
            Guard.ArgumentIsObject(target);
            RuntimeObject obj = target.ToObject();

            obj.DefinePropertyOrThrow(EcmaPropertyKey.FromValue(property), EcmaPropertyDescriptor.FromValue(attributes));
            return(target);
        }
예제 #2
0
        public static EcmaValue DefineProperties(EcmaValue target, EcmaValue properties)
        {
            Guard.ArgumentIsObject(target);
            RuntimeObject dst = target.ToObject();

            foreach (EcmaPropertyEntry e in properties.ToObject().GetEnumerableOwnProperties(true))
            {
                dst.DefinePropertyOrThrow(e.Key, EcmaPropertyDescriptor.FromValue(e.Value));
            }
            return(target);
        }