File tree Expand file tree Collapse file tree 2 files changed +5
-10
lines changed
Expand file tree Collapse file tree 2 files changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -13,17 +13,12 @@ import (
1313// Proxy is an interface that allows intercepting object property access.
1414type Proxy interface {
1515 // GetProperty returns the value of the property with the given key.
16- GetProperty (key any ) ( any , bool )
16+ GetProperty (key any ) any
1717}
1818
1919func Fetch (from , i any ) any {
2020 if proxy , ok := from .(Proxy ); ok {
21- r , ok := proxy .GetProperty (i )
22- if ! ok {
23- panic (fmt .Sprintf ("cannot fetch %v from proxy" , i ))
24- }
25-
26- return r
21+ return proxy .GetProperty (i )
2722 }
2823
2924 v := reflect .ValueOf (from )
Original file line number Diff line number Diff line change @@ -275,14 +275,14 @@ type proxyNode struct {
275275 values map [any ]any
276276}
277277
278- func (n * proxyNode ) GetProperty (key any ) ( any , bool ) {
278+ func (n * proxyNode ) GetProperty (key any ) any {
279279 if value , ok := n .values [key ]; ok {
280- return value , true
280+ return value
281281 }
282282 if n .parent != nil {
283283 return n .parent .GetProperty (key )
284284 }
285- return nil , false
285+ return nil
286286}
287287
288288func (n * proxyNode ) SetProperty (key any , value any ) {
You can’t perform that action at this time.
0 commit comments