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

Method GetFormatResult

CodeFormatCore/src/Format/FormatBuilder.cpp:13–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11}
12
13std::string FormatBuilder::GetFormatResult(const LuaSyntaxTree &t) {
14 _state.Analyze(t);
15 _formattedText.reserve(t.GetFile().GetSource().size());
16 auto root = t.GetRootNode();
17 std::vector<LuaSyntaxNode> startNodes = {root};
18
19 _state.DfsForeach(startNodes, t, [this](LuaSyntaxNode &syntaxNode, const LuaSyntaxTree &t, FormatResolve &resolve) {
20 DoResolve(syntaxNode, t, resolve);
21 });
22
23 DealEndWithNewLine(_state.GetStyle().insert_final_newline);
24 return _formattedText;
25}
26
27void FormatBuilder::WriteSyntaxNode(LuaSyntaxNode &syntaxNode, const LuaSyntaxTree &t) {
28 auto text = syntaxNode.GetText(t);

Callers 13

ReformatSingleFileMethod · 0.45
RangeReformatMethod · 0.45
ReformatMethod · 0.45
RangeFormatMethod · 0.45
mainFunction · 0.45
ReformatMethod · 0.45
RangeFormatMethod · 0.45
FormatByRangeMethod · 0.45
FormatMethod · 0.45
RangeFormatMethod · 0.45
TestFormattedMethod · 0.45
TestRangeFormattedMethod · 0.45

Calls 8

GetSourceMethod · 0.80
GetFileMethod · 0.80
GetRootNodeMethod · 0.80
DfsForeachMethod · 0.80
GetStyleMethod · 0.80
AnalyzeMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45

Tested by 3

mainFunction · 0.36
TestFormattedMethod · 0.36
TestRangeFormattedMethod · 0.36