@@ -449,24 +449,13 @@ function s:GoCompiler.compile_let(node)
449449 elseif left = ~ ' ^\v(self\.(find_command_cache|cache|buf|pos|context)|toplevel.body|lhs.list|(node\.(body|attr|else_|elseif|catch|finally|pattern|end(function|if|for|try))))$' && op == ' ='
450450 " skip initialization
451451 return
452- elseif left = ~ ' ^\v(node\.(list|depth))$' && op == ' ='
453- if right == ' nil' || right == ' []interface{}{}'
454- return
455- endif
456- call self .out (' %s %s %s' , left , op , right )
452+ elseif left = ~ ' ^\v%(node\.%(r?list|default_args|body))$' && op == ' ='
453+ call self .out (' %s %s %s' , left , op , substitute (right , ' []interface{}' , ' []*VimNode' , ' g' ))
457454 return
458- elseif left = ~ ' node.rlist' && op == ' ='
459- if right == ' []interface{}{}'
460- return
461- endif
462- let m = matchstr (right , ' \V[]interface{}{\zs\.\*\ze}\$' )
463- if m != ' '
464- call self .out (' %s = []*VimNode{%s}' , left , m )
465- else
466- call self .out (' %s = %s' , left , right )
467- endif
455+ elseif left == ' node.depth' && op == ' =' && right == ' nil'
456+ call self .out (' %s %s %s' , left , op , ' 0' )
468457 return
469- elseif left = ~ ' ^\v(list|curly_parts)$' && op == ' =' && right == ' []interface{}{}'
458+ elseif left = ~ ' ^\v(r? list|curly_parts)$' && op == ' =' && right == ' []interface{}{}'
470459 call self .out (' var %s []*VimNode' , left )
471460 return
472461 elseif left == ' cmd' && op == ' =' && (right == ' nil' || right = ~ ' ^\Vmap[string]interface{}{' )
0 commit comments