Skip to content

Commit 133692e

Browse files
committed
compile ternary operator of is_litdict
1 parent 114d682 commit 133692e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

go/gocompiler.vim

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,8 @@ function s:GoCompiler.compile_ternary(node)
642642
let right = self.compile(a:node.right)
643643
if cond =~ '^node\.rlist\[\d\]' && left == '"nil"'
644644
return printf('func() string { if %s {return %s} else {return %s.(string)} }()', cond, left, right)
645+
elseif cond == 'is_litdict'
646+
return printf('func() *VimNode { if %s {return %s} else {return %s} }()', cond, left, right)
645647
else
646648
return printf('viml_ternary(%s, %s, %s)', cond, left, right)
647649
endif

go/vimlparser.go

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)