summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2013-07-10 19:43:56 (GMT)
committerdgp <dgp@users.sourceforge.net>2013-07-10 19:43:56 (GMT)
commitef77c88392ff7b5d78b792b9d684a4ba30d175cc (patch)
tree764dee0b2092f673b7c10199ceb02f0bfa3f0f67
parent6f87f7f3302077aa68a48258e328bbf2ee5abd51 (diff)
downloadtcl-ef77c88392ff7b5d78b792b9d684a4ba30d175cc.zip
tcl-ef77c88392ff7b5d78b792b9d684a4ba30d175cc.tar.gz
tcl-ef77c88392ff7b5d78b792b9d684a4ba30d175cc.tar.bz2
Add tests for SetLineInformation() calls in tclCompCmdsGR.c.
-rw-r--r--generic/tclCompCmdsGR.c8
-rw-r--r--tests/info.test53
2 files changed, 57 insertions, 4 deletions
diff --git a/generic/tclCompCmdsGR.c b/generic/tclCompCmdsGR.c
index cc3f694..32514ab 100644
--- a/generic/tclCompCmdsGR.c
+++ b/generic/tclCompCmdsGR.c
@@ -222,7 +222,7 @@ TclCompileIfCmd(
compileScripts = 0;
}
} else {
- SetLineInformation(wordIdx);
+ LineInformation(wordIdx);
Tcl_ResetResult(interp);
TclCompileExprWords(interp, testTokenPtr, 1, envPtr);
if (jumpFalseFixupArray.next >= jumpFalseFixupArray.end) {
@@ -345,7 +345,7 @@ TclCompileIfCmd(
* Compile the else command body.
*/
- SetLineInformation(wordIdx);
+ LineInformation(wordIdx);
CompileBody(envPtr, tokenPtr, interp);
}
@@ -474,7 +474,7 @@ TclCompileIncrCmd(
PushLiteral(envPtr, word, numBytes);
}
} else {
- SetLineInformation(2);
+ LineInformation(2);
CompileTokens(envPtr, incrTokenPtr, interp);
}
} else { /* No incr amount given so use 1. */
@@ -701,7 +701,7 @@ TclCompileInfoLevelCmd(
* list of arguments.
*/
- SetLineInformation(1);
+ LineInformation(1);
CompileTokens(envPtr, TokenAfter(parsePtr->tokenPtr), interp);
TclEmitOpcode( INST_INFO_LEVEL_ARGS, envPtr);
}
diff --git a/tests/info.test b/tests/info.test
index 98bb724..98f6ea7 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -2109,6 +2109,59 @@ test info-33.13 {{*}, literal, simple, bytecompiled} -body {
} -result {type source line 2101 file info.test cmd {info frame 0} proc ::foo::bar level 0}
# -------------------------------------------------------------------------
+namespace eval foo {}
+proc foo::bar {} {
+ if {*}{
+ {[return [info frame 0]]}
+ {}
+ }
+}
+test info-33.14 {{*}, literal, simple, bytecompiled} -body {
+ reduce [foo::bar]
+} -cleanup {
+ namespace delete foo
+} -result {type source line 2115 file info.test cmd {info frame 0} proc ::foo::bar level 0}
+
+# -------------------------------------------------------------------------
+namespace eval foo {}
+proc foo::bar {} {
+ if 0 {*}{
+ {} else
+ {return [info frame 0]}
+ }
+}
+test info-33.15 {{*}, literal, simple, bytecompiled} -body {
+ reduce [foo::bar]
+} -cleanup {
+ namespace delete foo
+} -result {type source line 2130 file info.test cmd {info frame 0} proc ::foo::bar level 0}
+
+# -------------------------------------------------------------------------
+namespace eval foo {}
+proc foo::bar {} {
+ incr {*}{
+ x
+ } [return [info frame 0]]
+}
+test info-33.16 {{*}, literal, simple, bytecompiled} -body {
+ reduce [foo::bar]
+} -cleanup {
+ namespace delete foo
+} -result {type source line 2144 file info.test cmd {info frame 0} proc ::foo::bar level 0}
+
+# -------------------------------------------------------------------------
+namespace eval foo {}
+proc foo::bar {} {
+ info level {*}{
+ } [return [info frame 0]]
+}
+test info-33.16 {{*}, literal, simple, bytecompiled} -body {
+ reduce [foo::bar]
+} -cleanup {
+ namespace delete foo
+} -result {type source line 2156 file info.test cmd {info frame 0} proc ::foo::bar level 0}
+
+# -------------------------------------------------------------------------
unset -nocomplain res
# cleanup