@@ -452,24 +452,13 @@ function s:GoCompiler.compile_let(node)
452452 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 == ' ='
453453 " skip initialization
454454 return
455- elseif left = ~ ' ^\v(node\.(list|depth))$' && op == ' ='
456- if right == ' nil' || right == ' []interface{}{}'
457- return
458- endif
459- call self .out (' %s %s %s' , left , op , right )
455+ elseif left = ~ ' ^\v%(node\.%(r?list|default_args|body))$' && op == ' ='
456+ call self .out (' %s %s %s' , left , op , substitute (right , ' []interface{}' , ' []*VimNode' , ' g' ))
460457 return
461- elseif left = ~ ' node.rlist' && op == ' ='
462- if right == ' []interface{}{}'
463- return
464- endif
465- let m = matchstr (right , ' \V[]interface{}{\zs\.\*\ze}\$' )
466- if m != ' '
467- call self .out (' %s = []*VimNode{%s}' , left , m )
468- else
469- call self .out (' %s = %s' , left , right )
470- endif
458+ elseif left == ' node.depth' && op == ' =' && right == ' nil'
459+ call self .out (' %s %s %s' , left , op , ' 0' )
471460 return
472- elseif left = ~ ' ^\v(list|curly_parts)$' && op == ' =' && right == ' []interface{}{}'
461+ elseif left = ~ ' ^\v(r? list|curly_parts)$' && op == ' =' && right == ' []interface{}{}'
473462 call self .out (' var %s []*VimNode' , left )
474463 return
475464 elseif left == ' cmd' && op == ' =' && (right == ' nil' || right = ~ ' ^\Vmap[string]interface{}{' )
0 commit comments