Skip to content

Commit

Permalink
Eliminated constructors, see phetsims/phet-io#1213
Browse files Browse the repository at this point in the history
  • Loading branch information
samreid authored and zepumph committed Oct 18, 2018
1 parent a10883e commit 15d6ac2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
9 changes: 2 additions & 7 deletions js/types/TBoolean.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,15 @@ define( function( require ) {
'use strict';

// modules
var assertTypeOf = require( 'PHET_IO/assertions/assertTypeOf' );
var phetioInherit = require( 'PHET_IO/phetioInherit' );
var phetioNamespace = require( 'PHET_IO/phetioNamespace' );
var TObject = require( 'PHET_IO/types/TObject' );

/**
* Wrapper type for boolean primitives
* @param {boolean} instance
* @param {string} phetioID - the full unique tandem name for the instance
* @constructor
*/
function TBoolean( instance, phetioID ) {
TObject.call( this, instance, phetioID );
assertTypeOf( instance, 'boolean' );
function TBoolean() {
assert && assert( false, 'should never be called' );
}

phetioInherit( TObject, 'TBoolean', TBoolean, {}, {
Expand Down
8 changes: 2 additions & 6 deletions js/types/TString.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,16 @@ define( function( require ) {
'use strict';

// modules
var assertTypeOf = require( 'PHET_IO/assertions/assertTypeOf' );
var phetioInherit = require( 'PHET_IO/phetioInherit' );
var phetioNamespace = require( 'PHET_IO/phetioNamespace' );
var TObject = require( 'PHET_IO/types/TObject' );

/**
* Parametric wrapper type constructor for instrumented string instances.
* @param {string} instance
* @param {string} phetioID - the full unique tandem name for the instance
* @constructor
*/
function TString( instance, phetioID ) {
TObject.call( this, instance, phetioID );
assertTypeOf( instance, 'string' );
function TString() {
assert && assert( false, 'should never be called' );
}

phetioInherit( TObject, 'TString', TString, {}, {
Expand Down
8 changes: 2 additions & 6 deletions js/types/TVoid.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,10 @@ define( function( require ) {
var TObject = require( 'PHET_IO/types/TObject' );

/**
*
* @param instance
* @param phetioID
* @constructor
*/
function TVoid( instance, phetioID ) {
TObject.call( this, instance, phetioID );
assert && assert( false, 'cannot instantiate TVoid' );
function TVoid() {
assert && assert( false, 'should never be called' );
}

phetioInherit( TObject, 'TVoid', TVoid,
Expand Down

0 comments on commit 15d6ac2

Please sign in to comment.