MCPcopy
hub / github.com/aosabook/500lines / validateMethodOverride

Function validateMethodOverride

spreadsheet/code/as-react-livescript/main.js:7256–7284  ·  view source on GitHub ↗
(proto, name)

Source from the content-addressed store, hash-verified

7254 }
7255
7256 function validateMethodOverride(proto, name) {
7257 var specPolicy = ReactCompositeComponentInterface.hasOwnProperty(name) ?
7258 ReactCompositeComponentInterface[name] :
7259 null;
7260
7261 // Disallow overriding of base class methods unless explicitly allowed.
7262 if (ReactCompositeComponentMixin.hasOwnProperty(name)) {
7263 ("production" !== process.env.NODE_ENV ? invariant(
7264 specPolicy === SpecPolicy.OVERRIDE_BASE,
7265 'ReactCompositeComponentInterface: You are attempting to override ' +
7266 '`%s` from your class specification. Ensure that your method names ' +
7267 'do not overlap with React methods.',
7268 name
7269 ) : invariant(specPolicy === SpecPolicy.OVERRIDE_BASE));
7270 }
7271
7272 // Disallow defining methods more than once unless explicitly allowed.
7273 if (proto.hasOwnProperty(name)) {
7274 ("production" !== process.env.NODE_ENV ? invariant(
7275 specPolicy === SpecPolicy.DEFINE_MANY ||
7276 specPolicy === SpecPolicy.DEFINE_MANY_MERGED,
7277 'ReactCompositeComponentInterface: You are attempting to define ' +
7278 '`%s` on your component more than once. This conflict may be due ' +
7279 'to a mixin.',
7280 name
7281 ) : invariant(specPolicy === SpecPolicy.DEFINE_MANY ||
7282 specPolicy === SpecPolicy.DEFINE_MANY_MERGED));
7283 }
7284 }
7285
7286 function validateLifeCycleOnReplaceState(instance) {
7287 var compositeLifeCycleState = instance._compositeLifeCycleState;

Callers 1

mixSpecIntoComponentFunction · 0.85

Calls 1

invariantFunction · 0.85

Tested by

no test coverage detected