Skip to content

Commit

Permalink
Reapply "referenceIO.toStateObject asserts instrumentation, #312"
Browse files Browse the repository at this point in the history
This reverts commit 2fbf982.
  • Loading branch information
zepumph committed Aug 22, 2024
1 parent 293732c commit 33a30c3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/types/ReferenceIO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import IOType from './IOType.js';
import StringIO from './StringIO.js';
import { PhetioID } from '../TandemConstants.js';
import IOTypeCache from '../IOTypeCache.js';
import Tandem from '../Tandem.js';

// Cache each parameterized ReferenceIO so that it is only created once
const cache = new IOTypeCache();
Expand All @@ -41,6 +42,7 @@ const ReferenceIO = ( parameterType: IOType ): IOType => {
* directly to use this implementation.
*/
toStateObject( phetioObject ): ReferenceIOState {
assert && Tandem.VALIDATION && assert( phetioObject.isPhetioInstrumented(), 'Cannot reference an uninstrumented object', phetioObject );

// NOTE: We cannot assert that phetioObject.phetioState === false here because sometimes ReferenceIO is used statically like
// ReferenceIO( Vector2IO ).toStateObject( myVector );
Expand Down

0 comments on commit 33a30c3

Please sign in to comment.