• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

polserver / polserver / 25918451630

15 May 2026 12:43PM UTC coverage: 60.929% (+2.1%) from 58.859%
25918451630

push

github

turleypol
added dynamic property which returns a pointer of the object instead of
a copy like the current imp.
needed to be able to eg store a vector

43 of 61 new or added lines in 2 files covered. (70.49%)

14455 existing lines in 345 files now uncovered.

44695 of 73356 relevant lines covered (60.93%)

449621.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

89.66
/pol-core/bscript/compiler/optimizer/BinaryOperatorWithStringOptimizer.cpp
1
#include "BinaryOperatorWithStringOptimizer.h"
2

3
#include "bscript/bobject.h"
4
#include "bscript/compiler/ast/BinaryOperator.h"
5
#include "bscript/compiler/ast/BooleanValue.h"
6
#include "bscript/compiler/ast/FloatValue.h"
7
#include "bscript/compiler/ast/IntegerValue.h"
8
#include "bscript/compiler/ast/StringValue.h"
9

10
namespace Pol::Bscript::Compiler
11
{
12
BinaryOperatorWithStringOptimizer::BinaryOperatorWithStringOptimizer( StringValue& lhs,
1,546✔
13
                                                                      BinaryOperator& op )
1,546✔
14
    : lhs( lhs ), op( op )
1,546✔
15
{
16
}
1,546✔
17

18
void BinaryOperatorWithStringOptimizer::visit_children( Node& ) {}
345✔
19

20
void BinaryOperatorWithStringOptimizer::visit_string_value( StringValue& rhs )
150✔
21
{
22
  std::string value;
150✔
23
  switch ( op.token_id )
150✔
24
  {
25
  case TOK_ADD:
60✔
26
  {
27
    value = lhs.value + rhs.value;
60✔
28
    break;
60✔
29
  }
30

31
  default:
90✔
32
    return;
90✔
33
  }
34

35
  optimized_result = std::make_unique<StringValue>( op.source_location, value );
60✔
36
}
150✔
37

38
void BinaryOperatorWithStringOptimizer::visit_float_value( FloatValue& rhs )
12✔
39
{
40
  std::string value;
12✔
41
  switch ( op.token_id )
12✔
42
  {
43
  case TOK_ADD:
12✔
44
  {
45
    value = fmt::format( "{}{}", lhs.value, Bscript::Double::double_to_string( rhs.value ) );
24✔
46
    break;
12✔
47
  }
48

UNCOV
49
  default:
×
UNCOV
50
    return;
×
51
  }
52

53
  optimized_result = std::make_unique<StringValue>( op.source_location, value );
12✔
54
}
12✔
55

56
void BinaryOperatorWithStringOptimizer::visit_integer_value( IntegerValue& rhs )
18✔
57
{
58
  std::string value;
18✔
59
  switch ( op.token_id )
18✔
60
  {
61
  case TOK_ADD:
18✔
62
  {
63
    value = fmt::format( "{}{}", lhs.value, rhs.value );
36✔
64
    break;
18✔
65
  }
66

UNCOV
67
  default:
×
UNCOV
68
    return;
×
69
  }
70

71
  optimized_result = std::make_unique<StringValue>( op.source_location, value );
18✔
72
}
18✔
73

74
void BinaryOperatorWithStringOptimizer::visit_boolean_value( BooleanValue& rhs )
27✔
75
{
76
  auto setString = [&]( std::string&& val )
12✔
77
  { optimized_result = std::make_unique<StringValue>( op.source_location, val ); };
12✔
78
  auto setInt = [&]( int val )
15✔
79
  { optimized_result = std::make_unique<IntegerValue>( op.source_location, val ); };
15✔
80
  switch ( op.token_id )
27✔
81
  {
82
  case TOK_ADD:
12✔
83
    setString( fmt::format( "{}{}", lhs.value, rhs.value ) );
24✔
84
    break;
12✔
85
  case TOK_EQUAL:
6✔
86
    setInt( !lhs.value.empty() == rhs.value );
6✔
87
    break;
6✔
88
  case TOK_NEQ:
3✔
89
    setInt( !lhs.value.empty() != rhs.value );
3✔
90
    break;
3✔
91
  case TOK_OR:
3✔
92
    setInt( !lhs.value.empty() || rhs.value );
3✔
93
    break;
3✔
94
  case TOK_AND:
3✔
95
    setInt( !lhs.value.empty() && rhs.value );
3✔
96
    break;
3✔
UNCOV
97
  default:
×
UNCOV
98
    return;
×
99
  }
100
}
101
}  // namespace Pol::Bscript::Compiler
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc