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

Method UpdateLineInfo

LuaParser/src/File/LuaSource.cpp:139–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139void LuaSource::UpdateLineInfo(std::size_t startLine) {
140 auto totalLine = GetTotalLine();
141 std::size_t startOffset = 0;
142 if (totalLine < startLine) {
143 startLine = 0;
144 } else {
145 startOffset = _lineOffsetVec[startLine];
146 }
147
148 _lineOffsetVec.resize(startLine + 1);
149
150 for (; startOffset < _source.size(); startOffset++) {
151 if (_source[startOffset] == '\n') {
152 _lineOffsetVec.push_back(startOffset + 1);
153 }
154 }
155}
156
157void LuaSource::Reset() {
158 _lineOffsetVec.resize(0);

Callers 1

ParseMethod · 0.80

Calls 3

resizeMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected