Support another c brace style re. #64

This commit is contained in:
Andy K. Massimino
2019-06-17 20:24:03 -04:00
parent 411c32ae29
commit 729f9a9865
2 changed files with 18 additions and 3 deletions

View File

@@ -21,12 +21,16 @@ let s:adjust_max = 7
function! matchup#quirks#status_adjust(offscreen) abort " {{{1 function! matchup#quirks#status_adjust(offscreen) abort " {{{1
if a:offscreen.match ==# '{' && matchup#quirks#isclike() if a:offscreen.match ==# '{' && matchup#quirks#isclike()
\ && strpart(getline(a:offscreen.lnum), if strpart(getline(a:offscreen.lnum),
\ 0, a:offscreen.cnum-1) =~# '^\s*$' \ 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) " go up to next line with same indent (up to s:adjust_max)
for l:adjust in range(-1, -s:adjust_max, -1) for l:adjust in range(-1, -s:adjust_max, -1)
let l:lnum = a:offscreen.lnum + l:adjust 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*\%(#\|/\*\|//\)' \ && getline(l:lnum) !~ '^\s*\%(#\|/\*\|//\)'
return l:adjust return l:adjust
endif endif

11
test/issues/64/ast.cc Normal file
View File

@@ -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();
}