mirror of
https://github.com/robertkrimen/otto
synced 2025-10-12 20:27:30 +08:00
_argumentReference => _propertyReference
This commit is contained in:
parent
efc94517dd
commit
8f8534ae3f
|
@ -9,6 +9,8 @@ type _reference interface {
|
|||
Delete()
|
||||
}
|
||||
|
||||
// Reference
|
||||
|
||||
type _reference_ struct {
|
||||
name string
|
||||
strict bool
|
||||
|
@ -30,36 +32,7 @@ func (self _reference_) Delete() {
|
|||
panic(hereBeDragons())
|
||||
}
|
||||
|
||||
type _argumentReference struct {
|
||||
_reference_
|
||||
Base *_object
|
||||
}
|
||||
|
||||
func newArgumentReference(base *_object, name string, strict bool) *_argumentReference {
|
||||
if base == nil {
|
||||
panic(hereBeDragons())
|
||||
}
|
||||
return &_argumentReference{
|
||||
Base: base,
|
||||
_reference_: _reference_{
|
||||
name: name,
|
||||
strict: strict,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (self *_argumentReference) GetBase() *_object {
|
||||
return self.Base
|
||||
}
|
||||
|
||||
func (self *_argumentReference) GetValue() Value {
|
||||
return self.Base.get(self.name)
|
||||
}
|
||||
|
||||
func (self *_argumentReference) PutValue(value Value) bool {
|
||||
self.Base.set(self.name, value, self._reference_.strict)
|
||||
return true
|
||||
}
|
||||
// PropertyReference
|
||||
|
||||
type _propertyReference struct {
|
||||
_reference_
|
||||
|
@ -103,3 +76,12 @@ func (self *_propertyReference) Delete() {
|
|||
}
|
||||
self.Base.delete(self.name, self.Strict())
|
||||
}
|
||||
|
||||
// ArgumentReference
|
||||
|
||||
func newArgumentReference(base *_object, name string, strict bool) *_propertyReference {
|
||||
if base == nil {
|
||||
panic(hereBeDragons())
|
||||
}
|
||||
return newPropertyReference(base, name, strict, nil)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user