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

polserver / polserver / 21108840797

18 Jan 2026 08:35AM UTC coverage: 60.508% (+0.02%) from 60.492%
21108840797

push

github

web-flow
ClangTidy readability-else-after-return (#857)

* trigger tidy

* Automated clang-tidy change: readability-else-after-return

* compile test

* rerun

* Automated clang-tidy change: readability-else-after-return

* trigger..

* Automated clang-tidy change: readability-else-after-return

* manually removed a few

* Automated clang-tidy change: readability-else-after-return

* removed duplicate code

* fix remaining warnings

* fixed scope

---------

Co-authored-by: Clang Tidy <clang-tidy@users.noreply.github.com>

837 of 1874 new or added lines in 151 files covered. (44.66%)

46 existing lines in 25 files now uncovered.

44448 of 73458 relevant lines covered (60.51%)

525066.38 hits per line

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

54.22
/pol-core/bscript/eprog.cpp
1
/** @file
2
 *
3
 * @par History
4
 */
5

6
#include "eprog.h"
7

8
#include <cstdio>
9

10
#include "../clib/refptr.h"
11
#include "../clib/stlutil.h"
12
#include "escriptv.h"
13
#include "fmodule.h"
14

15

16
namespace Pol::Bscript
17
{
18
EScriptProgram::EScriptProgram()
2,143✔
19
    : ref_counted(),
20
      nglobals( 0 ),
2,143✔
21
      expectedArgs( 0 ),
2,143✔
22
      haveProgram( false ),
2,143✔
23
      name( "" ),
2,143✔
24
      modules(),
2,143✔
25
      tokens(),
2,143✔
26
      symbols(),
2,143✔
27
      exported_functions(),
2,143✔
28
      version( 0 ),
2,143✔
29
      invocations( 0 ),
2,143✔
30
      instr_cycles( 0 ),
2,143✔
31
      pkg( nullptr ),
2,143✔
32
      instr(),
2,143✔
33
      debug_loaded( false ),
2,143✔
34
      globalvarnames(),
2,143✔
35
      blocks(),
2,143✔
36
      dbg_functions(),
2,143✔
37
      dbg_filenames(),
2,143✔
38
      dbg_filenum(),
2,143✔
39
      dbg_linenum(),
2,143✔
40
      dbg_ins_blocks(),
2,143✔
41
      dbg_ins_statementbegin()
6,429✔
42
{
43
  ++escript_program_count;
2,143✔
44

45
  // compiler only:
46
  EPDbgBlock block;
2,143✔
47
  block.parentblockidx = 0;
2,143✔
48
  block.parentvariables = 0;
2,143✔
49
  blocks.push_back( block );
2,143✔
50
}
2,143✔
51

52
EScriptProgram::~EScriptProgram()
3,974✔
53
{
54
  Clib::delete_all( modules );
1,987✔
55
  --escript_program_count;
1,987✔
56
}
3,974✔
57

58
std::string EScriptProgram::dbg_get_instruction( size_t atPC ) const
×
59
{
60
  OSTRINGSTREAM os;
×
61
  os << instr[atPC].token;
×
62
  return OSTRINGSTREAM_STR( os );
×
63
}
×
64

65
size_t EScriptProgram::sizeEstimate() const
164✔
66
{
67
  using namespace Clib;
68
  size_t size = sizeof( EScriptProgram );
164✔
69
  size += memsize( globalvarnames );
164✔
70
  for ( const auto& l : globalvarnames )
206✔
71
    size += l.capacity();
42✔
72
  size += memsize( dbg_filenames );
164✔
73
  for ( const auto& l : dbg_filenames )
280✔
74
    size += l.capacity();
116✔
75
  size += memsize( dbg_filenum ) + memsize( dbg_linenum ) + memsize( dbg_ins_blocks ) +
164✔
76
          memsize( dbg_ins_statementbegin ) + memsize( modules ) + memsize( exported_functions ) +
164✔
77
          memsize( instr ) + memsize( blocks ) + memsize( dbg_functions );
164✔
78

79
  return size;
164✔
80
}
81

82
void EScriptProgram::dump( std::ostream& os )
×
83
{
84
  Token token;
×
85
  unsigned PC;
86
  if ( !exported_functions.empty() )
×
87
  {
88
    os << "Exported Functions:" << std::endl;
×
89
    os << "   PC  Args  Name" << std::endl;
×
90
    for ( auto& elem : exported_functions )
×
91
    {
92
      os << std::setw( 5 ) << elem.PC << std::setw( 6 ) << elem.nargs << "  " << elem.name
×
93
         << std::endl;
×
94
    }
95
  }
96
  unsigned nLines = tokens.length() / sizeof( StoredToken );
×
97
  for ( PC = 0; PC < nLines; PC++ )
×
98
  {
99
    if ( _readToken( token, PC ) )
×
100
    {
101
      return;
×
102
    }
103

NEW
104
    os << PC << ": " << token << std::endl;
×
NEW
105
    if ( token.id == INS_CASEJMP )
×
106
    {
NEW
107
      dump_casejmp( os, token );
×
108
    }
109
  }
110
}
×
111

112
void EScriptProgram::dump_casejmp( std::ostream& os, const Token& token )
×
113
{
114
  const unsigned char* dataptr = token.dataptr;
×
115
  for ( ;; )
116
  {
117
    unsigned short offset;
118
    std::memcpy( &offset, dataptr, sizeof( unsigned short ) );
×
119
    dataptr += 2;
×
120
    unsigned char type = *dataptr;
×
121
    dataptr += 1;
×
122
    if ( type == CASE_TYPE_LONG )
×
123
    {
124
      int lval;
125
      std::memcpy( &lval, dataptr, sizeof( int ) );
×
126
      dataptr += 4;
×
127
      os << "\t" << lval << ": @" << offset << std::endl;
×
128
    }
129
    else if ( type == CASE_TYPE_DEFAULT )
×
130
    {
131
      os << "\tdefault: @" << offset << std::endl;
×
132
      break;
×
133
    }
134
    else
135
    {  // type is the length of the string, otherwise
136
      os << "\t\"" << std::string( (const char*)dataptr, type ) << "\": @" << offset << std::endl;
×
137
      dataptr += type;
×
138
    }
139
  }
×
140
}
×
141
}  // namespace Pol::Bscript
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