public JsArguments(IGlobal global, JsFunction callee, JsInstance[] arguments)
: base(global.ObjectClass.New())
{
this.global = global;
// Add the named parameters
for (int i = 0; i < Math.Max(arguments.Length, callee.Arguments.Count); i++) {
ValueDescriptor d = new ValueDescriptor(this, i < callee.Arguments.Count ? callee.Arguments[i] : i.ToString()) { Attributes = PropertyAttributes.DontDelete };
d.Set(this, i < arguments.Length ? arguments[i] : JsUndefined.Instance);
this.DefineOwnProperty(i.ToString(), d);
}
length = arguments.Length;
calleeDescriptor = new ValueDescriptor(this, CALLEE) { Attributes = PropertyAttributes.DontEnum };
DefineOwnProperty(CALLEE, calleeDescriptor);
calleeDescriptor.Set(this, callee);
DefineOwnProperty("length", new PropertyDescriptor<JsArguments>(global, this, "length", GetLength) { Attributes = PropertyAttributes.DontEnum });
}