1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-26 20:28:49 +08:00

Shortcut the production of Object.Value()

This commit is contained in:
Robert Krimen
2012-10-11 18:22:00 -07:00
parent c57edbfe2b
commit 02929cbeb1
3 changed files with 10 additions and 4 deletions

View File

@@ -232,11 +232,14 @@ func (self Otto) Object(source string) (*Object, error) {
// Object is the representation of a JavaScript object.
type Object struct {
object *_object
value Value
}
func _newObject(object *_object) *Object {
func _newObject(object *_object, value Value) *Object {
// value MUST contain object!
return &Object{
object: object,
value: value,
}
}
@@ -261,7 +264,7 @@ func (self Object) Call(name string, argumentList... interface{}) (Value, error)
// Value will return self as a value.
func (self Object) Value() Value {
return toValue(self.object)
return self.value
}
// Get the value of the property with the given name.