Skip to content

Commit 2c02eec

Browse files
committed
style: run clang format
1 parent be2b6f7 commit 2c02eec

3 files changed

Lines changed: 63 additions & 47 deletions

File tree

inkcpp/operations.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ ink::runtime::internal::value
9090

9191
const value vs[] = {*this, oth};
9292
inkAssert(
93-
casting::common_base<2>(vs) != value_type::none,
94-
"try to redefine value of other type with no cast available"
93+
casting::common_base<2>(vs) != value_type::none,
94+
"try to redefine value of other type with no cast available"
9595
);
9696

9797
// There's a valid conversion, so redefine as input value.

inkcpp/string_operations.h

Lines changed: 60 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,63 +8,79 @@
88

99
/// defines operations allowed on strings.
1010

11-
namespace ink::runtime::internal {
11+
namespace ink::runtime::internal
12+
{
1213

13-
namespace casting {
14-
// define valid castings
15-
// when operate on float and string, the result is a string
16-
template<>
17-
struct cast<value_type::float32, value_type::string>
18-
{ static constexpr value_type value = value_type::string; };
19-
template<>
20-
struct cast<value_type::int32, value_type::string>
21-
{ static constexpr value_type value = value_type::string; };
22-
template<>
23-
struct cast<value_type::uint32, value_type::string>
24-
{ static constexpr value_type value = value_type::string; };
25-
template<>
26-
struct cast<value_type::boolean, value_type::string>
27-
{ static constexpr value_type value = value_type::string; };
28-
template<>
29-
struct cast<value_type::string, value_type::newline>
30-
{ static constexpr value_type value = value_type::string; };
31-
}
32-
33-
// operation declaration add
14+
namespace casting
15+
{
16+
// define valid castings
17+
// when operate on float and string, the result is a string
3418
template<>
35-
class operation<Command::ADD, value_type::string, void> : public operation_base<string_table> {
36-
public:
37-
using operation_base::operation_base;
38-
void operator()(basic_eval_stack& stack, value* vals);
19+
struct cast<value_type::float32, value_type::string> {
20+
static constexpr value_type value = value_type::string;
3921
};
4022

41-
// operation declaration equality
4223
template<>
43-
class operation<Command::IS_EQUAL, value_type::string, void> : public operation_base<void> {
44-
public:
45-
using operation_base::operation_base;
46-
void operator()(basic_eval_stack& stack, value* vals);
24+
struct cast<value_type::int32, value_type::string> {
25+
static constexpr value_type value = value_type::string;
4726
};
4827

4928
template<>
50-
class operation<Command::NOT_EQUAL, value_type::string, void> : public operation_base<void> {
51-
public:
52-
using operation_base::operation_base;
53-
void operator()(basic_eval_stack& stack, value* vals);
29+
struct cast<value_type::uint32, value_type::string> {
30+
static constexpr value_type value = value_type::string;
5431
};
5532

5633
template<>
57-
class operation<Command::HAS, value_type::string, void> : public operation_base<void> {
58-
public:
59-
using operation_base::operation_base;
60-
void operator()(basic_eval_stack& stack, value* vals);
34+
struct cast<value_type::boolean, value_type::string> {
35+
static constexpr value_type value = value_type::string;
6136
};
6237

6338
template<>
64-
class operation<Command::HASNT, value_type::string, void> : public operation_base<void> {
65-
public:
66-
using operation_base::operation_base;
67-
void operator()(basic_eval_stack& stack, value* vals);
39+
struct cast<value_type::string, value_type::newline> {
40+
static constexpr value_type value = value_type::string;
6841
};
42+
} // namespace casting
43+
44+
// operation declaration add
45+
template<>
46+
class operation<Command::ADD, value_type::string, void> : public operation_base<string_table>
47+
{
48+
public:
49+
using operation_base::operation_base;
50+
void operator()(basic_eval_stack& stack, value* vals);
51+
};
52+
53+
// operation declaration equality
54+
template<>
55+
class operation<Command::IS_EQUAL, value_type::string, void> : public operation_base<void>
56+
{
57+
public:
58+
using operation_base::operation_base;
59+
void operator()(basic_eval_stack& stack, value* vals);
60+
};
61+
62+
template<>
63+
class operation<Command::NOT_EQUAL, value_type::string, void> : public operation_base<void>
64+
{
65+
public:
66+
using operation_base::operation_base;
67+
void operator()(basic_eval_stack& stack, value* vals);
68+
};
69+
70+
template<>
71+
class operation<Command::HAS, value_type::string, void> : public operation_base<void>
72+
{
73+
public:
74+
using operation_base::operation_base;
75+
void operator()(basic_eval_stack& stack, value* vals);
76+
};
77+
78+
template<>
79+
class operation<Command::HASNT, value_type::string, void> : public operation_base<void>
80+
{
81+
public:
82+
using operation_base::operation_base;
83+
void operator()(basic_eval_stack& stack, value* vals);
84+
};
6985

70-
}
86+
} // namespace ink::runtime::internal

inkcpp_test/Fixes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ SCENARIO("Casting during redefinition is too strict _ #134", "[fixes]")
145145
THEN("expect assigned") { REQUIRE(line == "1.5 1.5 1.5 text0.5 B\n"); }
146146
}
147147

148-
// Six cases that should fail. We can't pollute lookahead with these so they need to be
148+
// Six cases that should fail. We can't pollute lookahead with these so they need to be
149149
// separated out.
150150
for (int i = 0; i < 6; ++i) {
151151
WHEN("Jump to failing case")

0 commit comments

Comments
 (0)