From 72249ce889e494da82b86272768b33cb1fc4bb48 Mon Sep 17 00:00:00 2001 From: BigBlack <840206@qq.com> Date: Thu, 14 Nov 2019 04:35:14 +0800 Subject: [PATCH] fix duplicate #define generation --- vlib/compiler/comptime.v | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vlib/compiler/comptime.v b/vlib/compiler/comptime.v index 4fd50ffa91..a9c7824e7b 100644 --- a/vlib/compiler/comptime.v +++ b/vlib/compiler/comptime.v @@ -230,7 +230,9 @@ fn (p mut Parser) chash() { } else if hash.contains('define') { // Move defines on top - p.cgen.includes << '#$hash' + if p.first_pass() { + p.cgen.includes << '#$hash' + } } // Don't parse a non-JS V file (`#-js` flag) else if hash == '-js' {