Skip to content

Commit f490df0

Browse files
tag was wrongly set for Pairlist
1 parent 800d054 commit f490df0

File tree

4 files changed

+14
-33
lines changed

4 files changed

+14
-33
lines changed

inst/include/Rcpp/Pairlist.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ namespace Rcpp{
4747

4848
void update(SEXP x){
4949
SET_TYPEOF( x, LISTSXP ) ;
50-
SET_TAG( x, R_NilValue ) ;
5150
}
5251
} ;
5352

inst/include/Rcpp/api/meat/DottedPairImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace Rcpp{
3939
while( !Rf_isNull(CDR(x)) ){
4040
x = CDR(x) ;
4141
}
42-
Shield<SEXP> tail( pairlist( object ) );
42+
Shield<SEXP> tail( grow( object, R_NilValue ) );
4343
SETCDR( x, tail ) ;
4444
}
4545
}

inst/include/Rcpp/grow.h

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ namespace Rcpp {
4040
namespace internal{
4141

4242
template <typename T>
43-
inline SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
44-
return grow( wrap(head), tail ) ;
45-
}
43+
inline SEXP grow__dispatch( ::Rcpp::traits::false_type, const T& head, SEXP tail ){
44+
return grow( wrap(head), tail ) ;
45+
}
4646

47-
template <typename T>
48-
inline SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
49-
Shield<SEXP> y( wrap( head.object) ) ;
50-
Shield<SEXP> x( Rf_cons( y , tail) ) ;
51-
SEXP headNameSym = ::Rf_install( head.name.c_str() );
52-
SET_TAG( x, headNameSym );
53-
return x;
54-
}
47+
template <typename T>
48+
inline SEXP grow__dispatch( ::Rcpp::traits::true_type, const T& head, SEXP tail ){
49+
Shield<SEXP> y( wrap( head.object) ) ;
50+
Shield<SEXP> x( Rf_cons( y , tail) ) ;
51+
SEXP headNameSym = ::Rf_install( head.name.c_str() );
52+
SET_TAG( x, headNameSym );
53+
return x;
54+
}
5555

5656
} // internal
5757

@@ -68,25 +68,7 @@ namespace Rcpp {
6868
return grow( Rf_mkString(head), tail ) ;
6969
}
7070

71-
72-
#ifdef HAS_VARIADIC_TEMPLATES
73-
74-
/* end of the recursion, wrap first to make the CAR and use R_NilValue as the CDR of the list */
75-
template<typename T>
76-
SEXP pairlist( const T& first){
77-
return grow(first, R_NilValue );
78-
}
79-
80-
template<typename T, typename... Args>
81-
SEXP pairlist( const T& first, const Args&... args ){
82-
return grow(first, pairlist(args...) );
83-
}
84-
85-
#else
86-
87-
#include <Rcpp/generated/grow__pairlist.h>
88-
89-
#endif
71+
#include <Rcpp/generated/grow__pairlist.h>
9072

9173
} // namespace Rcpp
9274

inst/unitTests/runit.Language.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ test.Language.in.env <- function(){
100100

101101
test.Pairlist <- function(){
102102
checkEquals( runit_pairlist( pairlist("rnorm") ), pairlist("rnorm" ), msg = "Pairlist( LISTSXP )" )
103-
# checkEquals( runit_pairlist( call("rnorm") ), pairlist(as.name("rnorm")), msg = "Pairlist( LANGSXP )" )
103+
checkEquals( runit_pairlist( call("rnorm") ), pairlist(as.name("rnorm")), msg = "Pairlist( LANGSXP )" )
104104
checkEquals( runit_pairlist(1:10), as.pairlist(1:10) , msg = "Pairlist( INTSXP) " )
105105
checkEquals( runit_pairlist(TRUE), as.pairlist( TRUE) , msg = "Pairlist( LGLSXP )" )
106106
checkEquals( runit_pairlist(1.3), as.pairlist(1.3), msg = "Pairlist( REALSXP) " )

0 commit comments

Comments
 (0)