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

polserver / polserver / 17062227329

19 Aug 2025 07:07AM UTC coverage: 59.82% (+0.02%) from 59.804%
17062227329

push

github

web-flow
Enum class fixes (#805)

* fix enum classes entries without initializer

* docs

* update grammar to support scoped identifiers in case labels

* add support for enum class constants in case statements

* add ScopableName to ConstDeclaration; formatting fixes; tests

* update docs

33 of 34 new or added lines in 7 files covered. (97.06%)

43687 of 73031 relevant lines covered (59.82%)

417068.97 hits per line

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

81.25
/pol-core/bscript/compiler/analyzer/Constants.cpp
1
#include "Constants.h"
2

3
#include "bscript/compiler/Report.h"
4
#include "bscript/compiler/ast/ConstDeclaration.h"
5

6
namespace Pol::Bscript::Compiler
7
{
8
Constants::Constants( Report& report ) : report( report ) {}
2,382✔
9

10
ConstDeclaration* Constants::find( const std::string& name )
85,425✔
11
{
12
  auto itr = constants.find( name );
85,425✔
13
  return ( itr != constants.end() ) ? ( *itr ).second : nullptr;
85,425✔
14
}
15

16
void Constants::create( ConstDeclaration& constant )
155,682✔
17
{
18
  auto name = constant.name.string();
155,682✔
19
  auto itr = constants.find( name );
155,682✔
20
  if ( itr != constants.end() )
155,682✔
21
  {
22
    if ( constant.ignore_overwrite_attempt )
9✔
23
    {
24
      // The OG compiler ignores enum members with the same name as a
25
      // constant or enum that was defined earlier.
26

27
      report.warning( constant,
×
28
                      "Constant '{}' definition ignored due to an earlier definition.\n"
29
                      "  Previous definition at: {}",
30
                      name, ( *itr ).second->source_location );
9✔
31
      return;
9✔
32
    }
33
    report.error( constant,
×
34
                  "Constant '{}' defined more than once.\n"
35
                  "  Previous definition at: {}",
NEW
36
                  name, ( *itr ).second->source_location );
×
37
  }
38

39
  constants[name] = &constant;
155,673✔
40
}
155,682✔
41

42
}  // namespace Pol::Bscript::Compiler
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc