From 9a63f8720dac0f99a618f295dcfdf6964f30e301 Mon Sep 17 00:00:00 2001 From: TopchetoEU <36534413+TopchetoEU@users.noreply.github.com> Date: Fri, 28 Oct 2022 10:10:56 +0300 Subject: [PATCH] fix: add default values to unassigned variables --- src/compiler/treeifier/ast/parsers/field.cc | 2 +- src/compiler/treeifier/ast/parsers/func.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/treeifier/ast/parsers/field.cc b/src/compiler/treeifier/ast/parsers/field.cc index d1f335f..e454884 100644 --- a/src/compiler/treeifier/ast/parsers/field.cc +++ b/src/compiler/treeifier/ast/parsers/field.cc @@ -7,7 +7,7 @@ bool ast::parse_field(ast_ctx_t &ctx, size_t &res_i, map_t &out) { if (!h.parse(parse_identifier, out["name"].map({}))) return false; - bool type, defval; + bool type = false, defval = false; h.throw_ended("Expected a colon or an equals sign."); diff --git a/src/compiler/treeifier/ast/parsers/func.cc b/src/compiler/treeifier/ast/parsers/func.cc index ca588a3..1931aa8 100644 --- a/src/compiler/treeifier/ast/parsers/func.cc +++ b/src/compiler/treeifier/ast/parsers/func.cc @@ -7,7 +7,7 @@ static bool parse_arg(ast_ctx_t &ctx, size_t &res_i, map_t &out) { if (!h.parse(parse_identifier, out["name"].map({}))) return false; - bool type, defval; + bool type = false, defval = false; h.throw_ended("Expected a colon or an equals sign.");