FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Found and fixed the bug that was very occasionally adding extra white… · ellen2015/cppfront@b839468 · GitHub

Repository navigation

Commit b839468

Browse files
committed
Found and fixed the bug that was very occasionally adding extra whitespace to some lines
1 parent 843d2de commit b839468

5 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎regression-tests/test-results/mixed-function-expression-with-pointer-capture.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
std::string y { "\n" };
2424
std::ranges::for_each( view, [_0 = (&y)](auto const& x){
2525
std::cout << (*_0 ).c_str() << x << *_0;
26-
} );
26+
} );
2727

2828
auto callback { [](auto& x) { return x += "-ish"; } };
2929
std::ranges::for_each( view, callback );

‎regression-tests/test-results/mixed-initialization-safety-3.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ auto fill(
1212
cpp2::out<std::string> x,
1313
cpp2::in<std::string> value,
1414
cpp2::in<int> count
15-
) -> void;
15+
) -> void;
1616
#line 26 "mixed-initialization-safety-3.cpp2"
1717
auto print_decorated(auto const& x) -> void;
1818
#line 28 "mixed-initialization-safety-3.cpp2"
@@ -37,7 +37,7 @@ auto fill(
3737
cpp2::out<std::string> x,
3838
cpp2::in<std::string> value,
3939
cpp2::in<int> count
40-
) -> void
40+
) -> void
4141

4242
{
4343
cpp2::Default.expects(CPP2_UFCS_0(size, value) >= count, "fill: value must contain at least count elements");

‎regression-tests/test-results/mixed-parameter-passing.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ auto parameter_styles(
1313
std::string b,
1414
std::string& c,
1515
std::string&& d
16-
) -> void;
16+
) -> void;
1717

1818
//=== Cpp2 definitions ==========================================================
1919

@@ -26,7 +26,7 @@ auto parameter_styles(
2626
std::string b,
2727
std::string& c,
2828
std::string&& d
29-
) -> void
29+
) -> void
3030
{
3131
int z { 12 };
3232

‎regression-tests/test-results/mixed-postfix-expression-custom-formatting.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@
1919
d::e( ++(*f).g(), // because f is foobar
2020
CPP2_UFCS_0(i, h),
2121
j(k, l))
22-
) ;
22+
);
2323
}

‎source/cppfront.cpp‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ class positional_printer
286286
}
287287

288288
// Finally, align to the target column
289-
pos.colno = std::max( 1, pos.colno + pad_for_this_line );
290-
print( pad( pos.colno - curr_pos.colno ) );
289+
if (curr_pos.lineno == pos.lineno) {
290+
pos.colno = std::max( 1, pos.colno + pad_for_this_line );
291+
print( pad( pos.colno - curr_pos.colno ) );
292+
}
291293
}
292294

293295

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL