From c0cc4701af372b17e6f6a60172f81424da7041ec Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Fri, 16 Aug 2019 08:50:36 +0300 Subject: [PATCH] $if debug { --- compiler/comptime.v | 8 +++++++- compiler/main.v | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/comptime.v b/compiler/comptime.v index 6b7bb7ee3c..10c330316a 100644 --- a/compiler/comptime.v +++ b/compiler/comptime.v @@ -34,6 +34,12 @@ fn (p mut Parser) comp_time() { p.genln('#endif') } } + else if name == 'debug' { + p.genln('#ifdef VDEBUG') + p.check(.lcbr) + p.statements_no_rcbr() + p.genln('#endif') + } else { println('Supported platforms:') println(SupportedPlatforms) @@ -51,7 +57,7 @@ fn (p mut Parser) comp_time() { p.genln('#endif') else_returns := p.returns p.returns = if_returns && else_returns - p.gen('/* returns $p.returns */') + p.gen('/* returns $p.returns */') } } else if p.tok == .key_for { diff --git a/compiler/main.v b/compiler/main.v index 6688ee1ce4..4151c54d1c 100644 --- a/compiler/main.v +++ b/compiler/main.v @@ -232,6 +232,9 @@ fn (v mut V) compile() { if v.pref.is_play { cgen.genln('#define VPLAY (1) ') } + if v.pref.is_debug { + cgen.genln('#define VDEBUG (1) ') + } cgen.genln(' #include // TODO remove all these includes, define all function signatures and types manually #include