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:
7
otto.go
7
otto.go
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user