Community
Participate
Working Groups
function doSomething(node) { switch (node.type) { case Node.TEXT_NODE: break; } } results in warning 'case expressions should be constant expressions'. since the is no way (at the moment) to define const in JS, this warning should be suppressed or at least optional. for the next example function MyObject() { } MyObject.MyConstant = 1; MyObject.prototype.MyOtherConstant = 2; MyObject.prototype.doSomething(value) { switch (node.type) { case MyObject.MyConstant: break; case this.MyOtherConstant: break; } } probably you should always generate a warning for 'case this.MyOtherConstant' but not for 'case MyObject.MyConstant:'
This problem has been removed as part of the work in https://bugs.eclipse.org/bugs/show_bug.cgi?id=268542. Case statements in JavaScript are not required to be constant values. *** This bug has been marked as a duplicate of bug 268542 ***