Skip to content

Commit c44f97b

Browse files
committed
Emit west const for locals, closes #44
1 parent 2998d93 commit c44f97b

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

regression-tests/test-results/mixed-lifetime-safety-and-null-contracts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ auto null_from_cpp1() -> int* { return nullptr; }
1515

1616
auto try_pointer_stuff() -> void;
1717
#line 21 "mixed-lifetime-safety-and-null-contracts.cpp2"
18-
auto call_my_framework(cpp2::in<char const *> msg) -> void;
18+
auto call_my_framework(cpp2::in<const char *> msg) -> void;
1919

2020
//=== Cpp2 definitions ==========================================================
2121

@@ -34,7 +34,7 @@ auto try_pointer_stuff() -> void{
3434
// to show -n
3535
}
3636

37-
auto call_my_framework(cpp2::in<char const *> msg) -> void {
37+
auto call_my_framework(cpp2::in<const char *> msg) -> void {
3838
std::cout
3939
<< "sending error to my framework... ["
4040
<< msg << "]\n"; }

regression-tests/test-results/mixed-type-safety-1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ auto print(cpp2::in<std::string> msg, auto const& x) -> void {
3030

3131
auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void
3232
{
33-
cpp2::deferred_init<char const*> bmsg;
33+
cpp2::deferred_init<const char*> bmsg;
3434
if (b) { bmsg.construct("true");}
3535
else { bmsg.construct("false");}
3636
std::cout << msg << bmsg.value() << "\n";

regression-tests/test-results/pure2-type-safety-1.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ auto test_generic(auto const& x) -> void{
4545
}
4646

4747
auto print(cpp2::in<std::string> msg, cpp2::in<bool> b) -> void{
48-
cpp2::deferred_init<char const*> bmsg;
48+
cpp2::deferred_init<const char*> bmsg;
4949
if (b) { bmsg.construct("true");}
5050
else { bmsg.construct("false");}
5151
std::cout << std::setw(40) << msg << bmsg.value() << "\n";

source/cppfront.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,14 +1030,14 @@ class cppfront
10301030
printer.print_cpp2("CPP2_FORWARD(", n.position());
10311031
}
10321032

1033-
assert(n.identifier);
1034-
emit(*n.identifier);
1035-
10361033
if (n.const_qualifier) {
1037-
printer.print_cpp2(" ", n.const_qualifier->position());
10381034
emit(*n.const_qualifier);
1035+
printer.print_cpp2(" ", n.const_qualifier->position());
10391036
}
10401037

1038+
assert(n.identifier);
1039+
emit(*n.identifier);
1040+
10411041
if (!n.template_args.empty()) {
10421042
printer.print_cpp2("<", n.open_angle);
10431043
auto first = true;

0 commit comments

Comments
 (0)