1
0
mirror of https://github.com/robertkrimen/otto synced 2025-09-28 18:45:22 +08:00
otto/type_arguments.go
2012-10-05 18:47:53 -07:00

17 lines
625 B
Go

package otto
func (runtime *_runtime) newArgumentsObject(argumentList []Value) *_object {
self := runtime.newClassObject("Arguments")
self.Prototype = runtime.Global.ObjectPrototype
for index, value := range argumentList {
// TODO Write test for runtime.GetValue(value)
// The problem here is possible reference nesting, is this the right place to GetValue?
self.WriteValue(arrayIndexToString(uint(index)), runtime.GetValue(value), false)
}
self.DefineOwnProperty("length", _property{Value: toValue(len(argumentList)), Mode: propertyModeWrite | propertyModeConfigure}.toDefineProperty(), false)
return self
}