diff options
author | Daniel Jasper <djasper@google.com> | 2014-06-10 14:44:02 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2014-06-10 14:44:02 +0000 |
commit | 17062ff5509495c41645155247241749e0f19a33 (patch) | |
tree | 9d7ae0af807eb05430cc7529eccd35b4081cfd03 /clang/lib/Format/ContinuationIndenter.cpp | |
parent | f910a0650eb4aad5e50e997c9438d7eef60dc901 (diff) | |
download | bcm5719-llvm-17062ff5509495c41645155247241749e0f19a33.tar.gz bcm5719-llvm-17062ff5509495c41645155247241749e0f19a33.zip |
clang-format: [JS] Treat dict literals similar to objc method exprs.
Before:
return {
link:
function() {
f(); //
}
};
return {
a: a,
link: function() {
f(); //
}
}
After:
return {
link: function() {
f(); //
}
};
return {
a: a,
link: function() {
f(); //
}
};
llvm-svn: 210537
Diffstat (limited to 'clang/lib/Format/ContinuationIndenter.cpp')
-rw-r--r-- | clang/lib/Format/ContinuationIndenter.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Format/ContinuationIndenter.cpp b/clang/lib/Format/ContinuationIndenter.cpp index 6304ff71fcd..39baef69306 100644 --- a/clang/lib/Format/ContinuationIndenter.cpp +++ b/clang/lib/Format/ContinuationIndenter.cpp @@ -195,7 +195,7 @@ bool ContinuationIndenter::mustBreak(const LineState &State) { State.Stack.back().FirstLessLess == 0) return true; - if (Current.Type == TT_ObjCSelectorName && + if (Current.Type == TT_SelectorName && State.Stack.back().ObjCSelectorNameFound && State.Stack.back().BreakBeforeParameter) return true; @@ -278,7 +278,7 @@ void ContinuationIndenter::addTokenOnCurrentLine(LineState &State, bool DryRun, Whitespaces.replaceWhitespace(Current, /*Newlines=*/0, /*IndentLevel=*/0, Spaces, State.Column + Spaces); - if (Current.Type == TT_ObjCSelectorName && + if (Current.Type == TT_SelectorName && !State.Stack.back().ObjCSelectorNameFound) { if (Current.LongestObjCSelectorName == 0) State.Stack.back().AlignColons = false; @@ -373,7 +373,7 @@ unsigned ContinuationIndenter::addTokenOnNewLine(LineState &State, if (NextNonComment->isMemberAccess()) { if (State.Stack.back().CallContinuation == 0) State.Stack.back().CallContinuation = State.Column; - } else if (NextNonComment->Type == TT_ObjCSelectorName) { + } else if (NextNonComment->Type == TT_SelectorName) { if (!State.Stack.back().ObjCSelectorNameFound) { if (NextNonComment->LongestObjCSelectorName == 0) { State.Stack.back().AlignColons = false; @@ -524,7 +524,7 @@ unsigned ContinuationIndenter::getNewLineColumn(const LineState &State) { (!Style.IndentFunctionDeclarationAfterType || State.Line->StartsDefinition))) return std::max(State.Stack.back().LastSpace, State.Stack.back().Indent); - if (NextNonComment->Type == TT_ObjCSelectorName) { + if (NextNonComment->Type == TT_SelectorName) { if (!State.Stack.back().ObjCSelectorNameFound) { if (NextNonComment->LongestObjCSelectorName == 0) { return State.Stack.back().Indent; @@ -597,7 +597,7 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State, if (Current.isMemberAccess()) State.Stack.back().StartOfFunctionCall = Current.LastOperator ? 0 : State.Column + Current.ColumnWidth; - if (Current.Type == TT_ObjCSelectorName) + if (Current.Type == TT_SelectorName) State.Stack.back().ObjCSelectorNameFound = true; if (Current.Type == TT_CtorInitializerColon) { // Indent 2 from the column, so: |