Skip to content

Commit e9ba66f

Browse files
author
Max Schaefer
committed
JavaScript: Address review comments.
1 parent 9479ae3 commit e9ba66f

File tree

1 file changed

+26
-9
lines changed
  • javascript/ql/src/semmle/javascript

1 file changed

+26
-9
lines changed

javascript/ql/src/semmle/javascript/Expr.qll

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ class BooleanLiteral extends @booleanliteral, Literal { }
355355
* 25
356356
* 0xffff
357357
* 6.626e-34
358-
* Infinity
359-
* NaN
360358
* ```
361359
*/
362360
class NumberLiteral extends @numberliteral, Literal {
@@ -741,9 +739,16 @@ class SpreadProperty extends Property {
741739
*
742740
* ```
743741
* var greet =
744-
* function() { // function expression
742+
* function g() { // function expression with name `g`
745743
* console.log("Hi!");
746744
* };
745+
*
746+
* class C {
747+
* m() { // methods are (anonymous) function expressions
748+
* return 1;
749+
* }
750+
* }
751+
* ```
747752
*/
748753
class FunctionExpr extends @functionexpr, Expr, Function {
749754
/** Gets the name of this function expression, if any. */
@@ -959,7 +964,6 @@ class InvokeExpr extends @invokeexpr, Expr {
959964
*
960965
* ```
961966
* new Array(16)
962-
* new
963967
* ```
964968
*/
965969
class NewExpr extends @newexpr, InvokeExpr { }
@@ -990,7 +994,7 @@ class CallExpr extends @callexpr, InvokeExpr {
990994
*
991995
* ```
992996
* Object.create(null)
993-
* [1, 2, 3].forEach(console.log);
997+
* [1, 2, 3].forEach(alert);
994998
* ```
995999
*/
9961000
class MethodCallExpr extends CallExpr {
@@ -2097,8 +2101,15 @@ class GeneratorExpr extends @generatorexpr, ComprehensionExpr { }
20972101
* Examples:
20982102
*
20992103
* ```
2100-
* for (x of [1, 2 3])
2101-
* for (x in o)
2104+
* [
2105+
* for (x of [1, 2 3]) // comprehension block
2106+
* x*x
2107+
* ]
2108+
*
2109+
* [
2110+
* for (x in o) // comprehension block
2111+
* "_" + x
2112+
* ]
21022113
* ```
21032114
*/
21042115
class ComprehensionBlock extends @comprehensionblock, Expr {
@@ -2120,7 +2131,10 @@ class ComprehensionBlock extends @comprehensionblock, Expr {
21202131
* Example:
21212132
*
21222133
* ```
2123-
* for (x in o)
2134+
* [
2135+
* for (x in o) // comprehension block
2136+
* "_" + x
2137+
* ]
21242138
* ```
21252139
*/
21262140
class ForInComprehensionBlock extends @forincomprehensionblock, ComprehensionBlock { }
@@ -2131,7 +2145,10 @@ class ForInComprehensionBlock extends @forincomprehensionblock, ComprehensionBlo
21312145
* Example:
21322146
*
21332147
* ```
2134-
* for (x of [1, 2, 3])
2148+
* [
2149+
* for (x of [1, 2 3]) // comprehension block
2150+
* x*x
2151+
* ]
21352152
* ```
21362153
*/
21372154
class ForOfComprehensionBlock extends @forofcomprehensionblock, ComprehensionBlock { }

0 commit comments

Comments
 (0)