Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

debug.fz


# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation.  If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
#  Tokiwa Software GmbH, Germany
#
#  Source code of Fuzion standard library feature debug
#
#  Author: Fridtjof Siebert (siebert@tokiwa.software)
#
# -----------------------------------------------------------------------

# debug -- features related to debug setting
#
# debug is a condition qualifier that enables conditions if debugging is
# enabled.
#
# this is true if and only if the debug level is greater than zero.
#
public debug bool => intrinsic  # 0 < debug_level   , intrinsic only to allow compiler to kick out debug code earlier


# debug(i32) is a condition qualifier that enables conditions if debugging is
# enabled at the given debug-level.
#
public debug(n i32) => n ≤ debug_level


# Current debug level, used by condition qualified debug(i32)
#
# This can be controlled using the "-debug=" option to the fz tool:
#
#     fz -debug=0 ex_debug.fz
#     fz -debug=3 -c ex_debug.fz
#
# Whatever option was set at compile time will be used when running a
# compile program.
#
public debug_level i32 => intrinsic