summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2015-05-19 20:34:10 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2015-05-19 20:34:10 (GMT)
commit5b379ffc49f71a2c6bccd3f1a282bdbca3a1d0b7 (patch)
tree3131c628e294c68ecd72898579198e2a490d688a
parentf2aa46953cedd6fe3b80766c84fb9720ae37f771 (diff)
parenta7e3535ca4d1e594e6d61e9f3c2305a3f49b7f33 (diff)
downloadtcl-5b379ffc49f71a2c6bccd3f1a282bdbca3a1d0b7.zip
tcl-5b379ffc49f71a2c6bccd3f1a282bdbca3a1d0b7.tar.gz
tcl-5b379ffc49f71a2c6bccd3f1a282bdbca3a1d0b7.tar.bz2
Simplify code generation for a list of literals. Generates slightly simpler bytecode too.
-rw-r--r--generic/tclCompCmdsGR.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index b77c43c..b9c655b 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -1210,20 +1210,7 @@ TclCompileListCmd(
valueTokenPtr = TokenAfter(valueTokenPtr);
}
if (listObj != NULL) {
- int len;
- const char *bytes = Tcl_GetStringFromObj(listObj, &len);
-
- PushLiteral(envPtr, bytes, len);
- Tcl_DecrRefCount(listObj);
- if (len > 0) {
- /*
- * Force list interpretation!
- */
-
- TclEmitOpcode( INST_DUP, envPtr);
- TclEmitOpcode( INST_LIST_LENGTH, envPtr);
- TclEmitOpcode( INST_POP, envPtr);
- }
+ TclEmitPush(TclAddLiteralObj(envPtr, listObj, NULL), envPtr);
return TCL_OK;
}