@@ -195,6 +195,9 @@ func (e *DefaultEnvironment) FindInScopes(nodescope *Scope, path []string) (yaml
195
195
if len (path ) > 0 {
196
196
scope := nodescope
197
197
for scope != nil {
198
+ if scope .local == nil {
199
+ break
200
+ }
198
201
val := scope .local [path [0 ]]
199
202
if val != nil {
200
203
return yaml .FindR (true , val , e .GetFeatures (), path [1 :]... )
@@ -216,8 +219,8 @@ func (e *DefaultEnvironment) FindReference(path []string) (yaml.Node, bool) {
216
219
}
217
220
return yaml .FindR (true , node (outer .GetRootBinding ()), e .GetFeatures (), path [1 :]... )
218
221
}
219
- //fmt.Printf("FIND %s: %s\n", strings.Join(path,"."), e)
220
- //fmt.Printf("FOUND %s: %v\n", strings.Join(path,"."), keys(nodescope))
222
+ // fmt.Printf("FIND %s: %s\n", strings.Join(path,"."), e)
223
+ // fmt.Printf("FOUND %s: %v\n", strings.Join(path,"."), keys(nodescope))
221
224
if path [0 ] == yaml .DOCNODE && nodescope != nil {
222
225
return e .FindInScopes (nodescope , path [1 :])
223
226
}
@@ -227,7 +230,7 @@ func (e *DefaultEnvironment) FindReference(path []string) (yaml.Node, bool) {
227
230
return nil , false
228
231
}
229
232
230
- //fmt.Printf("RESOLVE: %s: %s\n",path[0], dynaml.ExpressionType(root.Value()))
233
+ // fmt.Printf("RESOLVE: %s: %s\n",path[0], dynaml.ExpressionType(root.Value()))
231
234
if len (path ) > 1 && path [0 ] == yaml .SELF {
232
235
resolver := root .Resolver ()
233
236
return resolver .FindReference (path [1 :])
@@ -333,11 +336,11 @@ func (e *DefaultEnvironment) Flow(source yaml.Node, shouldOverride bool) (yaml.N
333
336
334
337
next = Cleanup (next , updateBinding (next , env ))
335
338
b := reflect .DeepEqual (result , next )
336
- //b,r:=yaml.Equals(result, next,[]string{})
339
+ // b,r:=yaml.Equals(result, next,[]string{})
337
340
if b {
338
341
break
339
342
}
340
- //fmt.Printf("****** found diff: %s\n", r)
343
+ // fmt.Printf("****** found diff: %s\n", r)
341
344
result = next
342
345
}
343
346
debug .Debug ("@@@ Done\n " )
@@ -425,8 +428,10 @@ func updateBinding(root yaml.Node, binding dynaml.Binding) CleanupFunction {
425
428
ref , ok := yaml .FindR (true , root , binding .GetFeatures (), scope .path ... )
426
429
if ok {
427
430
debug .Debug ("found %#v\n " , ref .Value ())
428
- m := ref .Value ().(map [string ]yaml.Node )
429
- scope .local = m
431
+ scope .local = nil
432
+ if m , ok := ref .Value ().(map [string ]yaml.Node ); ok {
433
+ scope .local = m
434
+ }
430
435
}
431
436
} else {
432
437
break
@@ -459,7 +464,7 @@ func resolveSymbol(env *DefaultEnvironment, name string, scope *Scope) (yaml.Nod
459
464
}
460
465
for scope != nil {
461
466
if nodescope == nil && scope .path != nil && scope .local != nil {
462
- //fmt.Printf("SCOPE NODE: <%s> %v %v\n", strings.Join(scope.path,"."), keys(scope.local), keys(scope.nodescope))
467
+ // fmt.Printf("SCOPE NODE: <%s> %v %v\n", strings.Join(scope.path,"."), keys(scope.local), keys(scope.nodescope))
463
468
nodescope = scope
464
469
}
465
470
val := scope .local [name ]
0 commit comments