Commit e7d1ac8 Tom Schwarzl
committed
1 parent 3a18a56 commit e7d1ac8 Copy full SHA for e7d1ac8
File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -238,8 +238,8 @@ is_class <- function(x) inherits(x, "S7_class")
238
238
239
239
# Object ------------------------------------------------------------------
240
240
241
- # ' @param .parent,... Parent object and named properties used to construct the
242
- # ' object.
241
+ # ' @param .parent,... Parent S7 object and named properties used to construct
242
+ # ' the object.
243
243
# ' @rdname new_class
244
244
# ' @export
245
245
new_object <- function (.parent , ... ) {
@@ -253,7 +253,15 @@ new_object <- function(.parent, ...) {
253
253
}
254
254
255
255
# force .parent before ...
256
- # TODO: Some type checking on `.parent`?
256
+ # TODO: Some additional type checking on `.parent`?
257
+
258
+ if (! inherits(.parent , " S7_object" ))
259
+ stop(" `.parent` needs to be an S7_object" )
260
+ if (inherits(.parent , " S7_class" )) {
261
+ stop(paste(" `.parent` cannot be of type S7_class. Did you type" ,
262
+ " `.parent = S7_object` instead of `.parent = S7_object()`?" ))
263
+ }
264
+
257
265
object <- .parent
258
266
259
267
args <- list (... )
You can’t perform that action at this time.
0 commit comments