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

polserver / polserver / 16578783200

28 Jul 2025 07:48PM UTC coverage: 59.79% (+0.2%) from 59.58%
16578783200

push

github

web-flow
Short Circuit Optimizer (#797)

* first working short curcuit for && and or
creates jumps after each expressions to skip the following

* fixed valuestack when short circuit jmp does not jump

* use specialized instructions for short circuit && and ||

1: lhs
2: logical jump if false/true goto 4 <- if jmp do logical convert
3: rhs
4: logical convert
5: rest

logical convert is needed since "normal" && || operations convert isTrue
to BLong

added BObjectRef BObjectImp set specialization to remove noise

* fixed converted objimp when jump on false values

* first version of short circuit warning
should be moved to analyzer
added whitelist of module functions which have no sideeffect to reduce
the number of warnings

* moved warning visitor to analyzer and added it as extra compile step
fixed sourceline print and cache the content

* missing include, unused member

* included the correct header

* ecompile.cfg to activate and warn
ecompile cmdline arg to activate it
run all tests also with it active
fixed that only the most right side statement was checked

* ecompile cmdline

* increase ecompile version
cleanup

* compilation error

* missing header

* allow -S- to deactivate shortcircuit like the other params do

* extended whitelist functions

* revert fileformat version increase
fixed escript test cmake

* use the correct arg

* escript testoutput can now be different if shortcircuit is active

* docs

* additional test

* addressed comments

210 of 239 new or added lines in 16 files covered. (87.87%)

1 existing line in 1 file now uncovered.

43653 of 73010 relevant lines covered (59.79%)

466031.96 hits per line

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

90.48
/pol-core/bscript/compiler/file/SourceFileIdentifier.cpp
1
#include "SourceFileIdentifier.h"
2
#include "clib/filecont.h"
3
#include "clib/strutil.h"
4

5
namespace Pol::Bscript::Compiler
6
{
7
SourceFileIdentifier::SourceFileIdentifier( unsigned index, std::string pathname )
9,100✔
8
    : index( index ), pathname( std::move( pathname ) ), _lines()
9,100✔
9
{
10
}
9,100✔
11

12
const std::vector<std::string>& SourceFileIdentifier::getLines() const
16✔
13
{
14
  if ( !_lines.empty() )
16✔
15
    return _lines;
15✔
16

17
  Clib::FileContents cont{ pathname.c_str(), true };
1✔
18
  std::string content{ cont.contents() };
1✔
19
  Clib::sanitizeUnicodeWithIso( &content );
1✔
20
  std::string::size_type pos = 0;
1✔
21
  std::string::size_type prev = 0;
1✔
22

23
  while ( ( pos = content.find_first_of( "\n\r", prev ) ) != std::string::npos )
33✔
24
  {
25
    auto strpos = pos;
32✔
26
    if ( content[pos] == '\r' && pos + 1 < content.size() && content[pos + 1] == '\n' )
32✔
NEW
27
      ++pos;  // windows lineendings..
×
28
    _lines.push_back( content.substr( prev, strpos - prev ) );
32✔
29
    prev = pos + 1;
32✔
30
  }
31

32
  if ( prev < content.length() )
1✔
NEW
33
    _lines.push_back( content.substr( prev ) );
×
34

35
  return _lines;
1✔
36
}
1✔
37
}  // 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