Author: coke
Date: Sun Jul 27 20:13:00 2008
New Revision: 29820

Modified:
   trunk/languages/tcl/lib/skipped_tests.tcl
   trunk/languages/tcl/runtime/builtin/lsort.pir

Log:
[tcl] Fix a bug in [lsort -integer] than modified the values we were sorting 
(converted them to their decimal integer form instead of leaving them 
unmodified)


Modified: trunk/languages/tcl/lib/skipped_tests.tcl
==============================================================================
--- trunk/languages/tcl/lib/skipped_tests.tcl   (original)
+++ trunk/languages/tcl/lib/skipped_tests.tcl   Sun Jul 27 20:13:00 2008
@@ -93,8 +93,6 @@
     cmdIL-1.1[1234] cmdIL-1.2[36] cmdIL-3.[23456] cmdIL-3.4.1 cmdIL-5.[234]
   } {[lsort -indices]} {
     cmdIL-1.27 cmdIL-1.28
-  } {[lsort] bug - don't modify the values you're sorting} {
-    cmdIL-3.1[19]
   } {[lsort -dictionary] - not sorting properly} {
     cmdIL-4.[145] cmdIL-4.1[27] cmdIL-4.2[089] cmdIL-4.3[0123]
   } {[lsort] misc} {

Modified: trunk/languages/tcl/runtime/builtin/lsort.pir
==============================================================================
--- trunk/languages/tcl/runtime/builtin/lsort.pir       (original)
+++ trunk/languages/tcl/runtime/builtin/lsort.pir       Sun Jul 27 20:13:00 2008
@@ -124,11 +124,13 @@
   .param pmc s2
 
   # check that they're actually integers.
-  # This points out that we should really be caching
-  # the integer value rather than recalculating on each compare.
+  # We recalculate this every time, but without smarter PMCs, we can't
+  # afford to change the string value of the given PMC.
   .local pmc toInteger
   toInteger = get_root_global ['_tcl'], 'toInteger'
   .local pmc i1,i2
+  s1 = clone s1
+  s2 = clone s2
   i1 = toInteger(s1)
   i2 = toInteger(s2)
   $I0 = cmp_num i1, i2
@@ -215,6 +217,8 @@
   # check that they're actually numbers
   .local pmc toNumber
   toNumber = get_root_global ['_tcl'], 'toNumber'
+  s1 = clone s1
+  s2 = clone s2
   s1 = toNumber(s1)
   s2 = toNumber(s2)
 

Reply via email to