Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | merge novem |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | dgp-refactor |
Files: | files | file ages | folders |
SHA1: |
636ad0e928169c6638a216b3c80abb53 |
User & Date: | dgp 2015-05-20 13:42:40 |
Context
2015-05-27
| ||
12:58 | merge novem check-in: eb5d28cac2 user: dgp tags: dgp-refactor | |
2015-05-20
| ||
13:42 | merge novem check-in: 636ad0e928 user: dgp tags: dgp-refactor | |
13:42 | merge trunk check-in: 118b4353ad user: dgp tags: novem | |
2015-05-14
| ||
11:20 | merge novem check-in: 782f3e764a user: dgp tags: dgp-refactor | |
Changes
Changes to doc/next.n.
︙ | ︙ | |||
92 93 94 95 96 97 98 | a filter and once as a normal method. .PP Each filter should decide for itself whether to permit the execution to go forward to the proper implementation of the method (which it does by invoking the \fBnext\fR command as filters are inserted into the front of the method call chain) and is responsible for returning the result of \fBnext\fR. .PP | | | | > > | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | a filter and once as a normal method. .PP Each filter should decide for itself whether to permit the execution to go forward to the proper implementation of the method (which it does by invoking the \fBnext\fR command as filters are inserted into the front of the method call chain) and is responsible for returning the result of \fBnext\fR. .PP Filters are invoked when processing an invokation of the \fBunknown\fR method because of a failure to locate a method implementation, but \fInot\fR when invoking either constructors or destructors. (Note however that the \fBdestroy\fR method is a conventional method, and filters are invoked as normal when it is called.) .SH EXAMPLES .PP This example demonstrates how to use the \fBnext\fR command to call the (super)class's implementation of a method. The script: .PP .CS oo::class create theSuperclass { |
︙ | ︙ |
Changes to doc/re_syntax.n.
︙ | ︙ | |||
679 680 681 682 683 684 685 | Subject to the constraints imposed by the rules for matching the whole RE, subexpressions also match the longest or shortest possible substrings, based on their preferences, with subexpressions starting earlier in the RE taking priority over ones starting later. Note that outer subexpressions thus take priority over their component subexpressions. .PP | | > > > > > > > > > > > > > > > > > > > > > > > > | 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | Subject to the constraints imposed by the rules for matching the whole RE, subexpressions also match the longest or shortest possible substrings, based on their preferences, with subexpressions starting earlier in the RE taking priority over ones starting later. Note that outer subexpressions thus take priority over their component subexpressions. .PP The quantifiers \fB{1,1}\fR and \fB{1,1}?\fR can be used to force longest and shortest preference, respectively, on a subexpression or a whole RE. .RS .PP \fBNOTE:\fR This means that you can usually make a RE be non-greedy overall by putting \fB{1,1}?\fR after one of the first non-constraint atoms or parenthesized sub-expressions in it. \fIIt pays to experiment\fR with the placing of this non-greediness override on a suitable range of input texts when you are writing a RE if you are using this level of complexity. .PP For example, this regular expression is non-greedy, and will match the shortest substring possible given that .QW \fBabc\fR will be matched as early as possible (the quantifier does not change that): .PP .CS ab{1,1}?c.*x.*cba .CE .PP The atom .QW \fBa\fR has no greediness preference, we explicitly give one for .QW \fBb\fR , and the remaining quantifiers are overridden to be non-greedy by the preceding non-greedy quantifier. .RE .PP Match lengths are measured in characters, not collating elements. An empty string is considered longer than no match at all. For example, .QW \fBbb*\fR matches the three middle characters of .QW \fBabbbc\fR , .QW \fB(week|wee)(night|knights)\fR |
︙ | ︙ |
Changes to generic/tclCompCmdsGR.c.
︙ | ︙ | |||
1198 1199 1200 1201 1202 1203 1204 | Tcl_DecrRefCount(objPtr); Tcl_DecrRefCount(listObj); listObj = NULL; } valueTokenPtr = TokenAfter(valueTokenPtr); } if (listObj != NULL) { | < < | < < < < < < < < < < < | 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 | Tcl_DecrRefCount(objPtr); Tcl_DecrRefCount(listObj); listObj = NULL; } valueTokenPtr = TokenAfter(valueTokenPtr); } if (listObj != NULL) { TclEmitPush(TclAddLiteralObj(envPtr, listObj, NULL), envPtr); return TCL_OK; } /* * Push the all values onto the stack. */ |
︙ | ︙ |
Changes to generic/tclExecute.c.
︙ | ︙ | |||
4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 | pcAdjustment = 2; cleanup = opnd; DECACHE_STACK_INFO(); iPtr->varFramePtr = framePtr->callerVarPtr; pc += pcAdjustment; TEBC_YIELD(); oPtr = contextPtr->oPtr; if (oPtr->flags & FILTER_HANDLING) { TclNRAddCallback(interp, FinalizeOONextFilter, framePtr, contextPtr, INT2PTR(contextPtr->index), INT2PTR(contextPtr->skip)); } else { TclNRAddCallback(interp, FinalizeOONext, | > | 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 | pcAdjustment = 2; cleanup = opnd; DECACHE_STACK_INFO(); iPtr->varFramePtr = framePtr->callerVarPtr; pc += pcAdjustment; TEBC_YIELD(); TclPushTailcallPoint(interp); oPtr = contextPtr->oPtr; if (oPtr->flags & FILTER_HANDLING) { TclNRAddCallback(interp, FinalizeOONextFilter, framePtr, contextPtr, INT2PTR(contextPtr->index), INT2PTR(contextPtr->skip)); } else { TclNRAddCallback(interp, FinalizeOONext, |
︙ | ︙ |
Changes to generic/tclOO.c.
︙ | ︙ | |||
1671 1672 1673 1674 1675 1676 1677 | } TclOODeleteContext(contextPtr); if (result != TCL_OK) { Tcl_DiscardInterpState(state); /* * Take care to not delete a deleted object; that would be | | > > > | 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 | } TclOODeleteContext(contextPtr); if (result != TCL_OK) { Tcl_DiscardInterpState(state); /* * Take care to not delete a deleted object; that would be * bad. [Bug 2903011] Also take care to make sure that we have * the name of the command before we delete it. [Bug * 9dd1bd7a74] */ if (!Deleted(oPtr)) { (void) TclOOObjectName(interp, oPtr); Tcl_DeleteCommandFromToken(interp, oPtr->command); } return NULL; } Tcl_RestoreInterpState(interp, state); } } |
︙ | ︙ | |||
1817 1818 1819 1820 1821 1822 1823 | } TclOODeleteContext(contextPtr); if (result != TCL_OK) { Tcl_DiscardInterpState(state); /* * Take care to not delete a deleted object; that would be bad. [Bug | | > > | 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 | } TclOODeleteContext(contextPtr); if (result != TCL_OK) { Tcl_DiscardInterpState(state); /* * Take care to not delete a deleted object; that would be bad. [Bug * 2903011] Also take care to make sure that we have the name of the * command before we delete it. [Bug 9dd1bd7a74] */ if (!Deleted(oPtr)) { (void) TclOOObjectName(interp, oPtr); Tcl_DeleteCommandFromToken(interp, oPtr->command); } DelRef(oPtr); return TCL_ERROR; } Tcl_RestoreInterpState(interp, state); *objectPtr = (Tcl_Object) oPtr; |
︙ | ︙ |
Changes to library/http/http.tcl.
︙ | ︙ | |||
561 562 563 564 565 566 567 568 569 570 571 572 573 574 | set srvurl $url set targetAddr [list $phost $pport] } else { set targetAddr [list $host $port] } # Proxy connections aren't shared among different hosts. set state(socketinfo) $host:$port # See if we are supposed to use a previously opened channel. if {$state(-keepalive)} { variable socketmap if {[info exists socketmap($state(socketinfo))]} { if {[catch {fconfigure $socketmap($state(socketinfo))}]} { Log "WARNING: socket for $state(socketinfo) was closed" | > > > > | 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | set srvurl $url set targetAddr [list $phost $pport] } else { set targetAddr [list $host $port] } # Proxy connections aren't shared among different hosts. set state(socketinfo) $host:$port # Save the accept types at this point to prevent a race condition. [Bug # c11a51c482] set state(accept-types) $http(-accept) # See if we are supposed to use a previously opened channel. if {$state(-keepalive)} { variable socketmap if {[info exists socketmap($state(socketinfo))]} { if {[catch {fconfigure $socketmap($state(socketinfo))}]} { Log "WARNING: socket for $state(socketinfo) was closed" |
︙ | ︙ | |||
633 634 635 636 637 638 639 | return -code error $err } } return $token } | > | > > > > > > > > > > > | | 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 | return -code error $err } } return $token } # http::Connected -- # # Callback used when the connection to the HTTP server is actually # established. # # Arguments: # token State token. # proto What protocol (http, https, etc.) was used to connect. # phost Are we using keep-alive? Non-empty if yes. # srvurl Service-local URL that we're requesting # Results: # None. proc http::Connected {token proto phost srvurl} { variable http variable urlTypes variable $token upvar 0 $token state # Set back the variables needed here |
︙ | ︙ | |||
687 688 689 690 691 692 693 694 695 | set how $state(-method) } # We cannot handle chunked encodings with -handler, so force HTTP/1.0 # until we can manage this. if {[info exists state(-handler)]} { set state(-protocol) 1.0 } if {[catch { puts $sock "$how $srvurl HTTP/$state(-protocol)" | > < | < | < | > > > > > < < > > > > > | 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | set how $state(-method) } # We cannot handle chunked encodings with -handler, so force HTTP/1.0 # until we can manage this. if {[info exists state(-handler)]} { set state(-protocol) 1.0 } set accept_types_seen 0 if {[catch { puts $sock "$how $srvurl HTTP/$state(-protocol)" if {[dict exists $state(-headers) Host]} { # Allow Host spoofing. [Bug 928154] puts $sock "Host: [dict get $state(-headers) Host]" } elseif {$port == $defport} { # Don't add port in this case, to handle broken servers. [Bug # #504508] puts $sock "Host: $host" } else { puts $sock "Host: $host:$port" } puts $sock "User-Agent: $http(-useragent)" if {$state(-protocol) == 1.0 && $state(-keepalive)} { puts $sock "Connection: keep-alive" } if {$state(-protocol) > 1.0 && !$state(-keepalive)} { puts $sock "Connection: close" ;# RFC2616 sec 8.1.2.1 } if {[info exists phost] && ($phost ne "") && $state(-keepalive)} { puts $sock "Proxy-Connection: Keep-Alive" } set accept_encoding_seen 0 set content_type_seen 0 dict for {key value} $state(-headers) { set value [string map [list \n "" \r ""] $value] set key [string map {" " -} [string trim $key]] if {[string equal -nocase $key "host"]} { continue } if {[string equal -nocase $key "accept-encoding"]} { set accept_encoding_seen 1 } if {[string equal -nocase $key "accept"]} { set accept_types_seen 1 } if {[string equal -nocase $key "content-type"]} { set content_type_seen 1 } if {[string equal -nocase $key "content-length"]} { set contDone 1 set state(querylength) $value } if {[string length $key]} { puts $sock "$key: $value" } } # Allow overriding the Accept header on a per-connection basis. Useful # for working with REST services. [Bug c11a51c482] if {!$accept_types_seen} { puts $sock "Accept: $state(accept-types)" } if {!$accept_encoding_seen && ![info exists state(-handler)]} { puts $sock "Accept-Encoding: gzip,deflate,compress" } if {$isQueryChannel && $state(querylength) == 0} { # Try to determine size of data in channel. If we cannot seek, the # surrounding catch will trap us |
︙ | ︙ | |||
791 792 793 794 795 796 797 | # if state(status) is error, it means someone's already called Finish # to do the above-described clean up. if {$state(status) ne "error"} { Finish $token $err } } | < | 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | # if state(status) is error, it means someone's already called Finish # to do the above-described clean up. if {$state(status) ne "error"} { Finish $token $err } } } # Data access functions: # Data - the URL data # Status - the transaction status: ok, reset, eof, timeout # Code - the HTTP transaction code, e.g., 200 # Size - the size of the URL data |
︙ | ︙ |
Changes to tests/http.test.
︙ | ︙ | |||
302 303 304 305 306 307 308 | http::cleanup $t } -result {ok {HTTP/1.0 200 Data follows}} test http-3.13 {http::geturl socket leak test} { set chanCount [llength [file channels]] for {set i 0} {$i < 3} {incr i} { catch {http::geturl $badurl -timeout 5000} } | < | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | http::cleanup $t } -result {ok {HTTP/1.0 200 Data follows}} test http-3.13 {http::geturl socket leak test} { set chanCount [llength [file channels]] for {set i 0} {$i < 3} {incr i} { catch {http::geturl $badurl -timeout 5000} } # No extra channels should be taken expr {[llength [file channels]] == $chanCount} } 1 test http-3.14 "http::geturl $fullurl" -body { set token [http::geturl $fullurl -validate 1] http::code $token } -cleanup { |
︙ | ︙ | |||
368 369 370 371 372 373 374 | } -result {Content-Length Content-Type Date X-Check} test http-3.27 {http::geturl: -headers override -type} -body { set token [http::geturl $url/headers -type "text/plain" -query dummy \ -headers [list "Content-Type" "text/plain;charset=utf-8"]] http::data $token } -cleanup { http::cleanup $token | | < > | < > | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 | } -result {Content-Length Content-Type Date X-Check} test http-3.27 {http::geturl: -headers override -type} -body { set token [http::geturl $url/headers -type "text/plain" -query dummy \ -headers [list "Content-Type" "text/plain;charset=utf-8"]] http::data $token } -cleanup { http::cleanup $token } -match regexp -result {(?n)Host .* User-Agent .* Connection close Content-Type {text/plain;charset=utf-8} Accept \*/\* Accept-Encoding .* Content-Length 5} test http-3.28 {http::geturl: -headers override -type default} -body { set token [http::geturl $url/headers -query dummy \ -headers [list "Content-Type" "text/plain;charset=utf-8"]] http::data $token } -cleanup { http::cleanup $token } -match regexp -result {(?n)Host .* User-Agent .* Connection close Content-Type {text/plain;charset=utf-8} Accept \*/\* Accept-Encoding .* Content-Length 5} test http-3.29 {http::geturl IPv6 address} -body { # We only want to see if the URL gets parsed correctly. This is # the case if http::geturl succeeds or returns a socket related # error. If the parsing is wrong, we'll get a parse error. # It'd be better to separate the URL parser from http::geturl, so |
︙ | ︙ | |||
414 415 416 417 418 419 420 421 422 423 424 425 426 427 | } -result 200 test http-3.31 {http::geturl fragment without path} -body { set token [http::geturl "$authorityurl#fragment42"] http::ncode $token } -cleanup { catch { http::cleanup $token } } -result 200 test http-4.1 {http::Event} -body { set token [http::geturl $url -keepalive 0] upvar #0 $token data array set meta $data(meta) expr {($data(totalsize) == $meta(Content-Length))} } -cleanup { http::cleanup $token | > > > > > > > > > > > > > > > | 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 | } -result 200 test http-3.31 {http::geturl fragment without path} -body { set token [http::geturl "$authorityurl#fragment42"] http::ncode $token } -cleanup { catch { http::cleanup $token } } -result 200 # Bug c11a51c482 test http-3.32 {http::geturl: -headers override -accept default} -body { set token [http::geturl $url/headers -query dummy \ -headers [list "Accept" "text/plain,application/tcl-test-value"]] http::data $token } -cleanup { http::cleanup $token } -match regexp -result {(?n)Host .* User-Agent .* Connection close Accept text/plain,application/tcl-test-value Accept-Encoding .* Content-Type application/x-www-form-urlencoded Content-Length 5} test http-4.1 {http::Event} -body { set token [http::geturl $url -keepalive 0] upvar #0 $token data array set meta $data(meta) expr {($data(totalsize) == $meta(Content-Length))} } -cleanup { http::cleanup $token |
︙ | ︙ |
Changes to tests/oo.test.
︙ | ︙ | |||
412 413 414 415 416 417 418 419 420 421 422 423 424 425 | namespace export t next namespace ensemble create } k t create X } -returnCodes error -cleanup { namespace delete k } -result {wrong # args: should be "k next j"} test oo-3.1 {basic test of OO functionality: destructor} -setup { # This is a bit complex because it needs to run in a sub-interp as we're # modifying the root object class's constructor interp create subinterp subinterp eval { package require TclOO | > > > > > > > > > > > > > > > > > > > > > > > > > | 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | namespace export t next namespace ensemble create } k t create X } -returnCodes error -cleanup { namespace delete k } -result {wrong # args: should be "k next j"} test oo-2.9 {construction failures and self creation} -setup { set ::result {} oo::class create Root } -body { oo::class create A { superclass Root constructor {} { lappend ::result "in A" error "failure in A" } destructor {lappend ::result [self]} } oo::class create B { superclass Root constructor {} { lappend ::result "in B [self]" error "failure in B" } destructor {lappend ::result [self]} } lappend ::result [catch {A create a} msg] $msg lappend ::result [catch {B create b} msg] $msg } -cleanup { Root destroy } -result {{in A} ::a 1 {failure in A} {in B ::b} ::b 1 {failure in B}} test oo-3.1 {basic test of OO functionality: destructor} -setup { # This is a bit complex because it needs to run in a sub-interp as we're # modifying the root object class's constructor interp create subinterp subinterp eval { package require TclOO |
︙ | ︙ | |||
1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | filter boo } set log {} list [Aobject outerfoo] $log } -cleanup { Aclass destroy } -result {foo {{::Aclass outerfoo} {::Aclass InnerFoo}}} test oo-13.1 {OO: changing an object's class} { oo::class create Aclass oo::define Aclass {method bar {} {lappend ::result "in A [self object]"}} oo::class create Bclass oo::define Bclass {method bar {} {lappend ::result "in B [self object]"}} set result [Aclass create foo] | > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 | filter boo } set log {} list [Aobject outerfoo] $log } -cleanup { Aclass destroy } -result {foo {{::Aclass outerfoo} {::Aclass InnerFoo}}} test oo-12.8 {OO: filters and destructors} -setup { oo::class create Aclass Aclass create Aobject set ::log {} } -body { oo::define Aclass { constructor {} { lappend ::log "in constructor" } destructor { lappend ::log "in destructor" } method bar {} { lappend ::log "in method" } method Boo args { lappend ::log [self target] next {*}$args } filter Boo } set obj [Aclass new] $obj bar $obj destroy return $::log } -cleanup { Aclass destroy } -result {{in constructor} {::Aclass bar} {in method} {::oo::object destroy} {in destructor}} test oo-13.1 {OO: changing an object's class} { oo::class create Aclass oo::define Aclass {method bar {} {lappend ::result "in A [self object]"}} oo::class create Bclass oo::define Bclass {method bar {} {lappend ::result "in B [self object]"}} set result [Aclass create foo] |
︙ | ︙ |
Changes to tests/ooNext2.test.
︙ | ︙ | |||
862 863 864 865 866 867 868 869 870 871 872 873 874 875 | } set ::result {} [B new] destroy return $::result } -cleanup { root destroy } -result {{{{method <destructor> ::B method} {method <destructor> ::A method}} 0} {{{method <destructor> ::B method} {method <destructor> ::A method}} 1}} cleanupTests return # Local Variables: # mode: tcl # End: | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | } set ::result {} [B new] destroy return $::result } -cleanup { root destroy } -result {{{{method <destructor> ::B method} {method <destructor> ::A method}} 0} {{{method <destructor> ::B method} {method <destructor> ::A method}} 1}} # Contributed tests from aspect, related to [0f42ff7871] # # dkf's "Principles Leading to a Fix" # # A method ought to work "the same" whether or not it has been overridden by # a subclass. A tailcalled command ought to have as parent stack the same # thing you'd get with uplevel 1. A subclass will often expect the # superclass's result to be the result that would be returned if the # subclass was not there. # Common setup: # any invocation of bar should emit "abc\nhi\n" then return to its # caller set testopts { -setup { oo::class create Master oo::class create Foo { superclass Master method bar {} { puts abc tailcall puts hi puts xyz } } oo::class create Foo2 { superclass Master } } -cleanup { Master destroy } } # these succeed, showing that without [next] the bug doesn't fire test next-tailcall-simple-1 "trivial case with one method" {*}$testopts -body { [Foo create foo] bar } -output [join {abc hi} \n]\n test next-tailcall-simple-2 "my bar" {*}$testopts -body { oo::define Foo method baz {} { puts a my bar puts b } [Foo create foo] baz } -output [join {a abc hi b} \n]\n test next-tailcall-simple-3 "\[self\] bar" {*}$testopts -body { oo::define Foo method baz {} { puts a [self] bar puts b } [Foo create foo] baz } -output [join {a abc hi b} \n]\n test next-tailcall-simple-4 "foo bar" {*}$testopts -body { oo::define Foo method baz {} { puts a foo bar puts b } [Foo create foo] baz } -output [join {a abc hi b} \n]\n # everything from here on uses [next], and fails on 8.6.4 with compilation test next-tailcall-superclass-1 "next superclass" {*}$testopts -body { oo::define Foo2 { superclass Foo method bar {} { puts a next puts b } } [Foo2 create foo] bar } -output [join {a abc hi b} \n]\n test next-tailcall-superclass-2 "nextto superclass" {*}$testopts -body { oo::define Foo2 { superclass Foo method bar {} { puts a nextto Foo puts b } } [Foo2 create foo] bar } -output [join {a abc hi b} \n]\n test next-tailcall-mixin-1 "class mixin" {*}$testopts -body { oo::define Foo2 { method Bar {} { puts a next puts b } filter Bar } oo::define Foo mixin Foo2 Foo create foo foo bar } -output [join {a abc hi b} \n]\n test next-tailcall-objmixin-1 "object mixin" {*}$testopts -body { oo::define Foo2 { method Bar {} { puts a next puts b } filter Bar } Foo create foo oo::objdefine foo mixin Foo2 foo bar } -output [join {a abc hi b} \n]\n test next-tailcall-filter-1 "filter method" {*}$testopts -body { oo::define Foo method Filter {} { puts a next puts b } oo::define Foo filter Filter [Foo new] bar } -output [join {a abc hi b} \n]\n test next-tailcall-forward-1 "forward method" {*}$testopts -body { proc foobar {} { puts "abc" tailcall puts "hi" puts "xyz" } oo::define Foo forward foobar foobar oo::define Foo2 { superclass Foo method foobar {} { puts a next puts b } } [Foo2 new] foobar } -output [join {a abc hi b} \n]\n test next-tailcall-constructor-1 "next in constructor" -body { oo::class create Foo { constructor {} { puts abc tailcall puts hi puts xyz } } oo::class create Foo2 { superclass Foo constructor {} { puts a next puts b } } list [Foo new] [Foo2 new] return "" } -cleanup { Foo destroy } -output [join {abc hi a abc hi b} \n]\n test next-tailcall-destructor-1 "next in destructor" -body { oo::class create Foo { destructor { puts abc tailcall puts hi puts xyz } } oo::class create Foo2 { superclass Foo destructor { puts a next puts b } } Foo create foo Foo2 create foo2 foo destroy foo2 destroy } -output [join {abc hi a abc hi b} \n]\n -cleanup { Foo destroy } unset testopts cleanupTests return # Local Variables: # mode: tcl # End: |