mirror of
https://github.com/robertkrimen/otto
synced 2025-10-19 19:55:30 +08:00
_argumentReference => _propertyReference
This commit is contained in:
parent
efc94517dd
commit
8f8534ae3f
|
|
@ -9,6 +9,8 @@ type _reference interface {
|
||||||
Delete()
|
Delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reference
|
||||||
|
|
||||||
type _reference_ struct {
|
type _reference_ struct {
|
||||||
name string
|
name string
|
||||||
strict bool
|
strict bool
|
||||||
|
|
@ -30,36 +32,7 @@ func (self _reference_) Delete() {
|
||||||
panic(hereBeDragons())
|
panic(hereBeDragons())
|
||||||
}
|
}
|
||||||
|
|
||||||
type _argumentReference struct {
|
// PropertyReference
|
||||||
_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
|
|
||||||
}
|
|
||||||
|
|
||||||
type _propertyReference struct {
|
type _propertyReference struct {
|
||||||
_reference_
|
_reference_
|
||||||
|
|
@ -103,3 +76,12 @@ func (self *_propertyReference) Delete() {
|
||||||
}
|
}
|
||||||
self.Base.delete(self.name, self.Strict())
|
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