@Specialization protected int doNArgs(VirtualFrame frame) { int result = 0; if (RArguments.getFunction(frame) == null) { return RRuntime.INT_NA; } int l = RArguments.getArgumentsLength(frame); for (int i = 0; i < l; i++) { Object arg = RArguments.getArgument(frame, i); if (arg instanceof RPromise) { isPromiseProfile.enter(); RPromise promise = (RPromise) arg; if (!promise.isDefault()) { result++; } } else if (arg instanceof RArgsValuesAndNames) { result += ((RArgsValuesAndNames) arg).getLength(); } else if (!(arg instanceof RMissing)) { result++; } } return result; }