Added constructor property to reserved members list
parent
958521f673
commit
9dbd0d1fb3
|
@ -55,7 +55,10 @@ var util = require( __dirname + '/util' ),
|
||||||
*
|
*
|
||||||
* @type {Object.<string,boolean>}
|
* @type {Object.<string,boolean>}
|
||||||
*/
|
*/
|
||||||
reserved_members = { '__initProps': true },
|
reserved_members = {
|
||||||
|
'__initProps': true,
|
||||||
|
'constructor': true,
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash of methods that must be public
|
* Hash of methods that must be public
|
||||||
|
|
|
@ -75,6 +75,36 @@ var common = require( './common' ),
|
||||||
} )();
|
} )();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test is to ensure that nobody (a) removes reserved members without
|
||||||
|
* understanding the consequences or (b) adds reserved members without properly
|
||||||
|
* documenting them.
|
||||||
|
*/
|
||||||
|
( function testProperMembersAreReserved()
|
||||||
|
{
|
||||||
|
var chk = [ '__initProps', 'constructor' ],
|
||||||
|
i = chk.length,
|
||||||
|
reserved = ClassBuilder.getReservedMembers();
|
||||||
|
|
||||||
|
while ( i-- )
|
||||||
|
{
|
||||||
|
var cur = chk[ i ];
|
||||||
|
|
||||||
|
assert.ok( reserved.hasOwnProperty( cur ),
|
||||||
|
"Member '" + cur + "' should be reserved"
|
||||||
|
);
|
||||||
|
|
||||||
|
delete reserved[ cur ];
|
||||||
|
}
|
||||||
|
|
||||||
|
// ensure there are no others that we didn't expect
|
||||||
|
for ( var name in reserved )
|
||||||
|
{
|
||||||
|
assert.fail( "Untested reserved member found: " + name );
|
||||||
|
}
|
||||||
|
} )();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that each of the reserved members will throw an exception if they are
|
* Ensure that each of the reserved members will throw an exception if they are
|
||||||
* used.
|
* used.
|
||||||
|
|
Loading…
Reference in New Issue