From c34a1db790a6518564d9a585d548f8a0b1d8de73 Mon Sep 17 00:00:00 2001 From: Shu-yu Guo Date: Wed, 22 Jun 2011 17:28:19 -0700 Subject: [PATCH] [INFER] Fix colorized spew bug with ANSI reset codes. r=mrbkap --- js/src/jsinfer.cpp | 10 +++++++++- js/src/jsinfer.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index d29ea1294e3..1746f9ed0cd 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -168,10 +168,18 @@ static bool InferSpewColorable() #ifdef DEBUG +const char * +types::InferSpewColorReset() +{ + if (!InferSpewColorable()) + return ""; + return "\x1b[0m"; +} + const char * types::InferSpewColor(TypeConstraint *constraint) { - /* Type constraints are printed out using background colors. */ + /* Type constraints are printed out using foreground colors. */ static const char *colors[] = { "\x1b[31m", "\x1b[32m", "\x1b[33m", "\x1b[34m", "\x1b[35m", "\x1b[36m", "\x1b[37m" }; diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index baf5a4ca435..2524c83236e 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -1038,7 +1038,7 @@ enum SpewChannel { #ifdef DEBUG -inline const char * InferSpewColorReset() { return "\x1b[0m"; } +const char * InferSpewColorReset(); const char * InferSpewColor(TypeConstraint *constraint); const char * InferSpewColor(TypeSet *types);