aboutsummaryrefslogtreecommitdiff
path: root/tests/expr.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-01-24 12:56:45 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:45 +1000
commit5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f (patch)
tree80fbe36dad45f9ee8ca33464933abf2a43f22db1 /tests/expr.test
parent9373863b490be45da1b823949ebd76425057dd3e (diff)
downloadjimtcl-5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f.zip
jimtcl-5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f.tar.gz
jimtcl-5dbbcf87423edb96cde7dfe59a2c8ef0a9d8ae2f.tar.bz2
Simplify and speed up expr
*: Reuse the ParseTokenList/ScriptToken machinery for 'expr' *: This is simpler than managing separate opcode/obj arrays *: expr opcodes are now in the same namespace as token types *: expr identifies int and double during parsing *: Move the 'while' common expr optimisations into Jim_EvalExpression *: Add a special trueObj and falseObj to help with these boolean optimisations *: Add lazy versions as the byte code is created instead of at the end *: Avoid repeated conversion attempts to int *: Once an object fails conversion to int and succeeds conversion to double, invalidate the string rep so the int conversion attempt no longer happens *: Also, avoid converting non-ints to int in expression optimisation *: No need for a string token for SEP and EOL tokens *: Fix shimmering of int -> double *: When an int shimmers to a double during an expression, remember that the value was originally an int (via a new type, coerced double)
Diffstat (limited to 'tests/expr.test')
-rw-r--r--tests/expr.test7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/expr.test b/tests/expr.test
index d7c7b5e..a7ba78c 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -130,4 +130,11 @@ test expr-3.2 "if: in, ni operators" {
}
} {1 4 5}
+# Don't want a to become 2.0
+test expr-4.1 "Shimmering" {
+ set a 2
+ expr {$a < 3.0}
+ set a
+} {2}
+
testreport