This is an automated email from the ASF dual-hosted git repository. joshtynjala pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/royale-compiler.git
commit 64df017d1df8e8c152b40d43466c7f9a47607013 Author: Josh Tynjala <[email protected]> AuthorDate: Tue Sep 17 14:03:25 2024 -0700 ConstantLogic: warn when comparing a Number or int literal to undefined --- .../apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg b/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg index d39326333..31a95df41 100644 --- a/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg +++ b/compiler/src/main/jburg/org/apache/royale/compiler/internal/as/codegen/ConstantLogic.jbg @@ -100,6 +100,10 @@ { String numberType = l instanceof Integer ? "int" : "Number"; recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, numberType, "null")); + } + if (r == UNDEFINED_VALUE) + { + recordError(new IllogicalComparisonWithUndefinedProblem(__p)); } return ECMASupport.equals(l, r); } @@ -111,6 +115,10 @@ { String numberType = r instanceof Integer ? "int" : "Number"; recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, numberType, "null")); + } + if (l == UNDEFINED_VALUE) + { + recordError(new IllogicalComparisonWithUndefinedProblem(__p)); } return ECMASupport.equals(l, r); }
