From 52d5e74e7e3975a97f539638a30dbc508365339c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 10 Sep 2013 21:48:15 -0500 Subject: [PATCH] Mark unsigned constants in AST dumps. - Add the u suffix to unsigned integer constants printed in AST dumps. --- src/zscript/ast.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/zscript/ast.cpp b/src/zscript/ast.cpp index bdb1d429c..b316208e9 100644 --- a/src/zscript/ast.cpp +++ b/src/zscript/ast.cpp @@ -140,10 +140,18 @@ public: { Add(&c, 1); } - void AddInt(int i) + void AddInt(int i, bool un=false) { char buf[16]; - size_t len = mysnprintf(buf, countof(buf), "%d", i); + size_t len; + if (!un) + { + len = mysnprintf(buf, countof(buf), "%d", i); + } + else + { + len = mysnprintf(buf, countof(buf), "%uu", i); + } Add(buf, len); } void AddHex(unsigned x) @@ -528,9 +536,9 @@ static void PrintExprConstant(FLispString &out, ZCC_TreeNode *node) { out.AddFloat(enode->DoubleVal); } - else + else if (enode->Type->IsKindOf(RUNTIME_CLASS(PInt))) { - out.AddInt(enode->IntVal); + out.AddInt(enode->IntVal, static_cast(enode->Type)->Unsigned); } out.Close(); }