mirror of
https://github.com/github/codeql.git
synced 2025-12-17 09:13:20 +01:00
This adds Alert annotations for alerts that seem intentional by the test but has not been annotated with 'NOT OK', or the comment was in the wrong place. In a few cases I included 'Source' expectations to make it easier to see what happened. Other 'Source' expectations will be added in bulk a later commit.
69 lines
1.2 KiB
JavaScript
69 lines
1.2 KiB
JavaScript
function Point(x, y) { // $ Alert
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
new Point(23, 42);
|
|
Point(56, 72);
|
|
|
|
function RobustPoint(x, y) {
|
|
if (!(this instanceof RobustPoint))
|
|
return new RobustPoint(x, y);
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
new RobustPoint(23, 42);
|
|
RobustPoint(56, 72);
|
|
|
|
function RobustPoint2(x, y) {
|
|
if (this.constructor !== RobustPoint2)
|
|
return new RobustPoint2(x, y);
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
new RobustPoint2(23, 42);
|
|
RobustPoint2(56, 72);
|
|
|
|
function RobustPoint3(x, y) {
|
|
var self = this;
|
|
if (self.constructor !== arguments.callee)
|
|
return new RobustPoint3(x, y);
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
new RobustPoint3(23, 42);
|
|
RobustPoint3(56, 72);
|
|
|
|
|
|
function RobustPoint4(x, y) {
|
|
if (this.constructor !== arguments.callee)
|
|
return new arguments.callee(x, y);
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
new RobustPoint4(23, 42);
|
|
RobustPoint4(56, 72);
|
|
|
|
// OK - Error is an external function
|
|
new Error();
|
|
Error();
|
|
|
|
class C {}
|
|
new C();
|
|
C(); // OK - flagged by IllegalInvocation
|
|
|
|
(function() {
|
|
function A(x) {
|
|
this.x = x;
|
|
}
|
|
new A(42);
|
|
A.call({}, 23);
|
|
})();
|
|
|
|
new Point(42, 23); // OK - not flagged since line 6 above was already flagged
|
|
Point(56, 72); // OK - not flagged since line 7 above was already flagged
|