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

polserver / polserver / 16205400460

10 Jul 2025 08:32PM UTC coverage: 59.527% (+0.2%) from 59.304%
16205400460

push

github

web-flow
Escript Optimizer more types and operator (#794)

* compile time optimization:
int with doubles and strings
doubles with ints and strings
strings with ints and doubles

* bool with other types, more unary ops, float branch optimizer

* more tests
fixed bool to dbl compare

* output cleanup
more tests

* optimize string values in if statements, optimize ternary operator

* optimize elvis, addes missing files, code cleanup

* use array to keep unoptimized if branch in funcexpr tests

* missing include

* better readable testdata

* removed file

* optimize while and dowhile loops if predicate is a compile time known
value

* cleaner variant of loop optimization?

* added ConstantPredicateLoop Node used by the optimizer for constant loop
predicates
optimize repeat until loop
change tests to run the loops more then once to be sure they work
correctly

* test break/continue with label for constant-loop

* docs

392 of 435 new or added lines in 16 files covered. (90.11%)

6 existing lines in 2 files now uncovered.

43324 of 72780 relevant lines covered (59.53%)

448442.97 hits per line

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

68.42
/pol-core/bscript/compiler/ast/ConstantPredicateLoop.cpp
1
#include "ConstantPredicateLoop.h"
2

3

4
#include "bscript/compiler/ast/Block.h"
5
#include "bscript/compiler/ast/NodeVisitor.h"
6

7
namespace Pol::Bscript::Compiler
8
{
9
ConstantPredicateLoop::ConstantPredicateLoop( const SourceLocation& source_location,
202✔
10
                                              std::string label, std::unique_ptr<Block> block,
11
                                              bool endless )
202✔
12
    : LoopStatement( source_location, std::move( label ) ), _endless( endless )
202✔
13
{
14
  children.reserve( 1 );
202✔
15
  children.push_back( std::move( block ) );
202✔
16
}
202✔
17

18
void ConstantPredicateLoop::accept( NodeVisitor& visitor )
808✔
19
{
20
  visitor.visit_constant_loop( *this );
808✔
21
}
808✔
22

NEW
23
void ConstantPredicateLoop::describe_to( std::string& w ) const
×
24
{
NEW
25
  fmt::format_to( std::back_inserter( w ), "constant-loop ({})",
×
NEW
26
                  is_endless() ? "endless" : "fallthrough" );
×
NEW
27
  if ( !get_label().empty() )
×
NEW
28
    fmt::format_to( std::back_inserter( w ), "(label:{})", get_label() );
×
NEW
29
}
×
30

31
Block& ConstantPredicateLoop::block()
202✔
32
{
33
  return child<Block>( 0 );
202✔
34
}
35

36
bool ConstantPredicateLoop::is_endless() const
202✔
37
{
38
  return _endless;
202✔
39
}
40
}  // 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