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

eclipse-aascw / aas-core-codegen / 36399939998

28 Sep 2026 08:52AM UTC coverage: 88.527% (+0.005%) from 88.522%
36399939998

push

github

web-flow
Transpile general if statements (#788)

We transpile the chains of ``if``, ``elif`` and ``else`` in the bodies
of transpilable functions which can not be mapped to a switch, *e.g.*:

    if number < 0 and len(text) > 0:
        return False
    elif number == 13:
        return False

The parse tree gets an ``If`` statement with a sequence of branches and
an optional default. The detection of switches stays greedy: a chain
whose first test compares a subject against constants is still
a switch, and a non-matching ``elif`` becomes an if-statement in its
default.

The type inference refuses the conditions which are not booleans, as
the targets do not share Python's truthiness, and treats the branches
as block scopes, analogous to the switches. We deliberately do not
narrow the types by the conditions yet, *e.g.*, ``x`` stays optional in
the body of ``if x is not None:``.

All the targets transpile to native chains of ``if`` and ``else if``.
Java and C++ share the writing of the chains with their fallback for
the switches on ``long`` and strings, respectively.

Along the way, we fix the line break of the long assignments in Go,
which ended with a stray parenthesis, ``x :=\n\tvalue)``.

The new common meta-model ``if_statements`` covers the variants,
including a ``continue`` in a branch nested in a for-loop.

349 of 402 new or added lines in 13 files covered. (86.82%)

2 existing lines in 2 files now uncovered.

41589 of 46979 relevant lines covered (88.53%)

2.66 hits per line

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

75.79
/aas_core_codegen/cpp/optionaling.py


Source Not Available

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