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 db16e856d567f444fba3082afbb3020d2da08a7c Author: Josh Tynjala <[email protected]> AuthorDate: Tue Sep 17 14:08:56 2024 -0700 ConstantLogic: null and undefined warnings for strict equals too --- .../compiler/internal/as/codegen/ConstantLogic.jbg | 30 ++++++++++++++++++++++ 1 file changed, 30 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 31a95df41..8fa0f86e5 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 @@ -150,6 +150,36 @@ return ECMASupport.equals(l, r); } + boolean_constant= + Op_StrictEqualID(numeric_constant l, constant_value r) : 0 + { + if (r == NULL_VALUE) + { + String numberType = l instanceof Integer ? "int" : "Number"; + recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, numberType, "null")); + } + if (r == UNDEFINED_VALUE) + { + recordError(new IllogicalComparisonWithUndefinedProblem(__p)); + } + return ECMASupport.strictEquals(l, r); + } + + boolean_constant= + Op_StrictEqualID(constant_value l, numeric_constant r) : 0 + { + if (l == NULL_VALUE) + { + String numberType = r instanceof Integer ? "int" : "Number"; + recordError(new ComparisonBetweenUnrelatedTypesProblem(__p, numberType, "null")); + } + if (l == UNDEFINED_VALUE) + { + recordError(new IllogicalComparisonWithUndefinedProblem(__p)); + } + return ECMASupport.strictEquals(l, r); + } + boolean_constant= Op_StrictEqualID(constant_value l, constant_value r): 0 {
