File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
src/arkreactor/Compiler/AST Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ namespace Ark::internal
8484 *
8585 * @return distance in characters from the beginning of the file to the cursor
8686 */
87- long getCount () { return std::distance (m_str.begin (), m_it); }
87+ long getCount () { return static_cast < long >( std::distance (m_str.begin (), m_it) ); }
8888
8989 /* *
9090 *
Original file line number Diff line number Diff line change @@ -84,15 +84,18 @@ namespace Ark::internal
8484 if (std::cmp_greater_equal (n, m_str.size ()))
8585 return ;
8686
87- m_it = m_str.begin () + n;
87+ if (std::cmp_less (n, m_str.size ()))
88+ m_it = m_str.begin () + n;
89+ else
90+ m_it = m_str.begin ();
91+
8892 auto [it, sym] = utf8_char_t::at (m_it, m_str.end ());
8993 m_next_it = it;
9094 m_sym = sym;
9195
9296 // search for the nearest it < m_it in the map to know the line number
93- for (std:: size_t i = 0 , end = m_it_to_row. size (); i < end; ++i )
97+ for (const auto & [at, line] : m_it_to_row)
9498 {
95- auto [at, line] = m_it_to_row[i];
9699 if (it <= at)
97100 {
98101 m_filepos.row = line - 1 ;
You can’t perform that action at this time.
0 commit comments