From a5f0086a7f5b2cb6b133bcbd76662f12a383f1a0 Mon Sep 17 00:00:00 2001 From: NotFound Date: Sun, 10 Jul 2011 01:43:27 +0200 Subject: [PATCH] allow non string values in get_class builtin --- winxedst1.winxed | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/winxedst1.winxed b/winxedst1.winxed index bdbc2c4..fc78f0b 100644 --- a/winxedst1.winxed +++ b/winxedst1.winxed @@ -97,8 +97,9 @@ function InternalError(string msg, var pos [optional], int has_pos [opt_flag]) msg = msg + ' near ' + desc; } var payload = has_pos ? - new WinxedCompilerError(ERR_INTERNAL, msg) : - new WinxedCompilerError(ERR_INTERNAL, msg, pos.filename(), pos.linenum()); + new WinxedCompilerError(ERR_INTERNAL, msg, + pos.filename(), pos.linenum()) : + new WinxedCompilerError(ERR_INTERNAL, msg); throw Error(msg, 2, __WINXED_ERROR__, payload); } @@ -747,6 +748,7 @@ const string // Pseudotypes for predefined functions REGarglist = '*', REGany = '?', + REGs_v = 'p', // string or var REGraw1 = '!', // raw mode one arg REGnone = 'v'; // void return @@ -1652,7 +1654,7 @@ getinterp $P0 ), new PredefFunction('get_class', 'get_class %0, %1', - REGvar, REGstring + REGvar, REGs_v ), new PredefFunction('typeof', 'typeof %0, %1', @@ -5134,10 +5136,14 @@ class CallPredefExpr : Expr } } else { - if (argtype == paramtype || paramtype == REGany) + if (argtype == paramtype || paramtype == REGany || + (paramtype == REGs_v && + (argtype == REGstring || argtype == REGvar))) argr = arg.emit_get(e); else { string aux; + if (paramtype == REGs_v) + paramtype = REGvar; argr = self.tempreg(paramtype); switch (paramtype) { case REGvar: