diff options
author | Cary Clark <caryclark@skia.org> | 2018-04-03 15:31:59 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-03 20:02:25 +0000 |
commit | a4f581a475b2f4990d0e1d0a1703107cb429bcb2 (patch) | |
tree | d1427582f9e17e83c732c46ecad692d6efc80008 /tools/bookmaker/includeWriter.cpp | |
parent | 3a494f6eb487bcbb5f732aeccab9da6d1c9b618e (diff) |
fix global method indentation
Check to see if a method is inside a struct or class
before increasing its indentation. Also, add missing
description.
Docs-Preview: https://skia.org/?cl=118381
Bug: skia:6898
Change-Id: I9402442a89dafc96d87bf69f157dcfa40cdf6e2b
Reviewed-on: https://skia-review.googlesource.com/118381
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/includeWriter.cpp')
-rw-r--r-- | tools/bookmaker/includeWriter.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp index 5b2f8076bc..9fd238ac78 100644 --- a/tools/bookmaker/includeWriter.cpp +++ b/tools/bookmaker/includeWriter.cpp @@ -439,8 +439,7 @@ void IncludeWriter::enumMembersOut(const RootDefinition* root, Definition& child (int) (preprocessor.fEnd - preprocessor.fStart), preprocessor.fStart); this->lfcr(); fIndent = saveIndent; - preprocessor.fStart = nullptr; - preprocessor.fEnd = nullptr; + preprocessor.reset(); } if (token && State::kItemValue == state) { fStart = token->fContentStart; @@ -547,6 +546,7 @@ bool IncludeWriter::enumPreprocessor(Definition* token, MemberPass pass, return true; // ignore old inline comments } if (Bracket::kPound == token->fBracket) { // preprocessor wraps member + preprocessor->fDefinition = token; preprocessor->fStart = token->fContentStart; if (KeyWord::kIf == token->fKeyWord || KeyWord::kIfdef == token->fKeyWord) { iterStack.emplace_back(token->fTokens.begin(), token->fTokens.end()); @@ -567,6 +567,15 @@ bool IncludeWriter::enumPreprocessor(Definition* token, MemberPass pass, } return true; } + if (preprocessor->fDefinition) { + if (Bracket::kParen == token->fBracket) { + preprocessor->fEnd = token->fContentEnd; + SkASSERT(')' == *preprocessor->fEnd); + ++preprocessor->fEnd; + return true; + } + SkASSERT(0); // incomplete + } return true; } if (token && Definition::Type::kWord != token->fType) { @@ -674,7 +683,11 @@ void IncludeWriter::methodOut(const Definition* method, const Definition& child) fMethodDef = &child; fContinuation = nullptr; fDeferComment = nullptr; - if (0 == fIndent || fIndentNext) { + const Definition* csParent = method->csParent(); + if (!csParent) { + SkDebugf(""); + } + if (csParent && (0 == fIndent || fIndentNext)) { fIndent += 4; fIndentNext = false; } |