Author: coke
Date: Fri Jan 13 07:34:23 2006
New Revision: 11147

Modified:
   trunk/languages/tcl/lib/expression.pir
   trunk/languages/tcl/t/cmd_expr.t
Log:
tcl -

o string arguments to expr must be given a chance to be interpreted as
  numbers. This fixes the TODO'd expr bugs. but:
o This doesn't fix the bugs in break and continue, so add another expr
  test which is more likely the cause.



Modified: trunk/languages/tcl/lib/expression.pir
==============================================================================
--- trunk/languages/tcl/lib/expression.pir      (original)
+++ trunk/languages/tcl/lib/expression.pir      Fri Jan 13 07:34:23 2006
@@ -258,6 +258,16 @@ number:
 quote:
   ($P0, $I0) = get_quote(expr, pos)
   inc $I0
+  .local string type_o
+  type_o = typeof $P0
+  #XXX Too protective?
+  if type_o != "TclConst" goto done_quote
+  # quotes can contain numbers that should be treated as such. Is this a 
number?
+  push_eh done_quote
+    $P1 = __number($P0)
+  clear_eh
+  .return ($P1,$I0)
+done_quote:
   .return($P0, $I0)
 
 brace:

Modified: trunk/languages/tcl/t/cmd_expr.t
==============================================================================
--- trunk/languages/tcl/t/cmd_expr.t    (original)
+++ trunk/languages/tcl/t/cmd_expr.t    Fri Jan 13 07:34:23 2006
@@ -2,7 +2,7 @@
 
 use strict;
 use lib qw(tcl/t t . ../lib ../../lib ../../../lib);
-use Parrot::Test tests => 97;
+use Parrot::Test tests => 98;
 use Test::More;
 
 language_output_is("tcl",<<TCL,<<OUT,"int");
@@ -96,6 +96,13 @@ language_output_is("tcl",<<'TCL',<<OUT,"
 TCL
 0
 OUT
+
+language_output_is("tcl",<<'TCL',<<OUT,"lt, numeric, not alpha, with vars and 
braces");
+ set a 10
+ puts [expr {$a < 9}]
+TCL
+0
+OUT
 
 language_output_is("tcl",<<TCL,<<OUT,"lt, true");
  puts [expr 2 < 3]

Reply via email to