Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ee943f

Browse files
author
Esben Sparre Andreasen
committed
JS: restrict alert location to a single line
1 parent e1947f0 commit 8ee943f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

javascript/ql/src/LanguageFeatures/ThisBeforeSuper.ql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
import javascript
14+
import semmle.javascript.RestrictedLocations
1415

1516
/**
1617
* Holds if `e` is an expression of the given `kind` that must be guarded by a
@@ -59,4 +60,4 @@ where needsGuard(e, kind) and unguarded(e, ctor) and
5960
sc.getBinder() = ctor and
6061
sc.getEnclosingFunction() != ctor
6162
)
62-
select ctor, "The super constructor must be called before using '$@'.", e, kind
63+
select (FirstLineOf)ctor, "The super constructor must be called before using '$@'.", e, kind

javascript/ql/test/query-tests/LanguageFeatures/ThisBeforeSuper/ThisBeforeSuper.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010
| invalid.js:14:35:14:118 | () { cl ... er(); } | The super constructor must be called before using '$@'. | invalid.js:14:99:14:102 | this | this |
1111
| invalid.js:15:71:15:95 | () { th ... er(); } | The super constructor must be called before using '$@'. | invalid.js:15:76:15:79 | this | this |
1212
| invalid.js:16:35:16:66 | () { if ... .a(); } | The super constructor must be called before using '$@'. | invalid.js:16:56:16:59 | this | this |
13-
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:27:9:27:12 | this | this |
14-
| invalid.js:26:16:29:5 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:28:9:28:12 | this | this |
13+
| invalid.js:26:16:26:19 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:27:9:27:12 | this | this |
14+
| invalid.js:26:16:26:19 | () {\\n ... ;\\n } | The super constructor must be called before using '$@'. | invalid.js:28:9:28:12 | this | this |

0 commit comments

Comments
 (0)