Merge pull request #4517 from erik-krogh/logAssign

Approved by esbena
This commit is contained in:
CodeQL CI
2020-10-20 05:24:49 -07:00
committed by GitHub
4 changed files with 22 additions and 3 deletions

View File

@@ -130,7 +130,13 @@ class NumericConversion extends ImplicitConversion {
or
parent instanceof ArithmeticExpr and not parent instanceof AddExpr
or
parent instanceof CompoundAssignExpr and not parent instanceof AssignAddExpr
parent instanceof CompoundAssignExpr and
not (
parent instanceof AssignAddExpr or
parent instanceof AssignLogOrExpr or
parent instanceof AssignLogAndExpr or
parent instanceof AssignNullishCoalescingExpr
)
or
parent instanceof UpdateExpr
}

View File

@@ -2053,7 +2053,7 @@ class AssignAndExpr extends @assign_and_expr, CompoundAssignExpr { }
* x ||= y
* ```
*/
class AssignLogOrExpr extends @assignlogandexpr, CompoundAssignExpr { }
class AssignLogOrExpr extends @assignlogorexpr, CompoundAssignExpr { }
/**
* A logical-'and'-assign expression.
@@ -2064,7 +2064,7 @@ class AssignLogOrExpr extends @assignlogandexpr, CompoundAssignExpr { }
* x &&= y
* ```
*/
class AssignLogAndExpr extends @assignlogorexpr, CompoundAssignExpr { }
class AssignLogAndExpr extends @assignlogandexpr, CompoundAssignExpr { }
/**
* A 'nullish-coalescing'-assign expression.

View File

@@ -13,3 +13,5 @@
| tst.js:106:5:106:7 | g() | This expression will be implicitly converted from undefined to number. |
| tst.js:109:13:109:15 | g() | This expression will be implicitly converted from undefined to number. |
| tst.js:110:13:110:15 | g() | This expression will be implicitly converted from undefined to string. |
| tst.js:117:8:117:8 | y | This expression will be implicitly converted from string to number. |
| tst.js:122:10:122:10 | y | This expression will be implicitly converted from string to number. |

View File

@@ -110,3 +110,14 @@ function l() {
var b = g() + "str";
});
function m() {
var x = 19, y = "string";
x %= y; // NOT OK
x += y; // OK
x ||= y; // OK
x &&= y; // OK
x ??= y; // OK
x >>>= y; // NOT OK
}