From 729f9a9865d5975d206bf0a37cc2c0cd94663799 Mon Sep 17 00:00:00 2001 From: "Andy K. Massimino" Date: Mon, 17 Jun 2019 20:24:03 -0400 Subject: [PATCH] Support another c brace style re. #64 --- autoload/matchup/quirks.vim | 10 +++++++--- test/issues/64/ast.cc | 11 +++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 test/issues/64/ast.cc diff --git a/autoload/matchup/quirks.vim b/autoload/matchup/quirks.vim index 98cb449..b9bbcac 100644 --- a/autoload/matchup/quirks.vim +++ b/autoload/matchup/quirks.vim @@ -21,12 +21,16 @@ let s:adjust_max = 7 function! matchup#quirks#status_adjust(offscreen) abort " {{{1 if a:offscreen.match ==# '{' && matchup#quirks#isclike() - \ && strpart(getline(a:offscreen.lnum), - \ 0, a:offscreen.cnum-1) =~# '^\s*$' + if strpart(getline(a:offscreen.lnum), + \ 0, a:offscreen.cnum-1) =~# '^\s*$' + let l:target = indent(a:offscreen.lnum) + else + let l:target = indent(a:offscreen.links.close.lnum) + endif " go up to next line with same indent (up to s:adjust_max) for l:adjust in range(-1, -s:adjust_max, -1) let l:lnum = a:offscreen.lnum + l:adjust - if indent(l:lnum) == indent(a:offscreen.lnum) + if indent(l:lnum) == l:target \ && getline(l:lnum) !~ '^\s*\%(#\|/\*\|//\)' return l:adjust endif diff --git a/test/issues/64/ast.cc b/test/issues/64/ast.cc new file mode 100644 index 0000000..dc87df8 --- /dev/null +++ b/test/issues/64/ast.cc @@ -0,0 +1,11 @@ +Error ASTNodeImporter::ImportFunctionDeclBody(FunctionDecl *FromFD, + FunctionDecl *ToFD) { + if (Stmt *FromBody = FromFD->getBody()) { + if (ExpectedStmt ToBodyOrErr = import(FromBody)) + ToFD->setBody(*ToBodyOrErr); + else + return ToBodyOrErr.takeError(); + } + return Error::success(); +} +