Skip to content

Commit d30f8bc

Browse files
author
maechler
committed
no need to check for S4SXP type in addition to IS_S4_OBJECT(.); +cosmetic: use CADR etc
git-svn-id: https://svn.r-project.org/R/trunk@83913 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 63d25bc commit d30f8bc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/deparse.c

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* R : A Computer Language for Statistical Data Analysis
3-
* Copyright (C) 1997--2022 The R Core Team
3+
* Copyright (C) 1997--2023 The R Core Team
44
* Copyright (C) 1995, 1996 Robert Gentleman and Ross Ihaka
55
*
66
* This program is free software; you can redistribute it and/or modify
@@ -888,8 +888,7 @@ static void deparse2buff(SEXP s, LocalParseData *d)
888888

889889
if (!d->active) return;
890890

891-
Rboolean hasS4_t = TYPEOF(s) == S4SXP;
892-
if (IS_S4_OBJECT(s) || hasS4_t) {
891+
if (IS_S4_OBJECT(s)) {
893892
d->isS4 = TRUE;
894893
/* const void *vmax = vmaxget(); */
895894
SEXP class = getAttrib(s, R_ClassSymbol),
@@ -912,6 +911,7 @@ static void deparse2buff(SEXP s, LocalParseData *d)
912911
UNPROTECT(2); // (e, cl_def)
913912
int n;
914913
Rboolean has_Data = FALSE;// does it have ".Data" slot?
914+
Rboolean hasS4_t = TYPEOF(s) == S4SXP;
915915
if(TYPEOF(slotNms) == STRSXP && (n = LENGTH(slotNms))) {
916916
PROTECT(slotNms);
917917
SEXP slotlist = PROTECT(allocVector(VECSXP, n));
@@ -1178,15 +1178,15 @@ static void deparse2buff(SEXP s, LocalParseData *d)
11781178
deparse2buff(CAR(s), d);
11791179
print2buff(") ", d);
11801180
if (d->incurly && !d->inlist ) {
1181-
lookahead = curlyahead(CAR(CDR(s)));
1181+
lookahead = curlyahead(CADR(s));
11821182
if (!lookahead) {
11831183
writeline(d);
11841184
d->indent++;
11851185
}
11861186
}
11871187
/* need to find out if there is an else */
11881188
if (length(s) > 2) {
1189-
deparse2buff(CAR(CDR(s)), d);
1189+
deparse2buff(CADR(s), d);
11901190
if (d->incurly && !d->inlist) {
11911191
writeline(d);
11921192
if (!lookahead)
@@ -1195,10 +1195,10 @@ static void deparse2buff(SEXP s, LocalParseData *d)
11951195
else
11961196
print2buff(" ", d);
11971197
print2buff("else ", d);
1198-
deparse2buff(CAR(CDDR(s)), d);
1198+
deparse2buff(CADDR(s), d);
11991199
}
12001200
else {
1201-
deparse2buff(CAR(CDR(s)), d);
1201+
deparse2buff(CADR(s), d);
12021202
if (d->incurly && !lookahead && !d->inlist )
12031203
d->indent--;
12041204
}
@@ -1215,7 +1215,7 @@ static void deparse2buff(SEXP s, LocalParseData *d)
12151215
print2buff(" in ", d);
12161216
deparse2buff(CADR(s), d);
12171217
print2buff(") ", d);
1218-
deparse2buff(CADR(CDR(s)), d);
1218+
deparse2buff(CADDR(s), d);
12191219
break;
12201220
case PP_REPEAT:
12211221
print2buff("repeat ", d);

0 commit comments

Comments
 (0)