MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / AddRelativeIndent

Method AddRelativeIndent

CodeFormatCore/src/Format/FormatState.cpp:72–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70}
71
72void FormatState::AddRelativeIndent(LuaSyntaxNode syntaxNoe, std::size_t indent) {
73 if (_indentStack.empty()) {
74 _indentStack.emplace(syntaxNoe, 0, 0);
75 return;
76 }
77 auto top = _indentStack.top();
78 switch (_formatStyle.indent_style) {
79 case IndentStyle::Space: {
80 _indentStack.emplace(syntaxNoe, top.SpaceSize + indent, top.TabSize);
81 break;
82 }
83 case IndentStyle::Tab: {
84 auto tabIndent = indent / _formatStyle.tab_width;
85 auto spaceIndent = indent % _formatStyle.tab_width;
86 _indentStack.emplace(syntaxNoe, top.SpaceSize + spaceIndent, top.TabSize + tabIndent);
87 break;
88 }
89 }
90}
91
92void FormatState::AddInvertIndent(LuaSyntaxNode syntaxNoe, std::size_t indent) {
93 if (_indentStack.empty()) {

Callers

nothing calls this directly

Calls 3

topMethod · 0.80
emptyMethod · 0.45
emplaceMethod · 0.45

Tested by

no test coverage detected