#1421 js: equality operators compile like assignments

vkuzkokov Mon 21 Feb 2011

It happens if lhs is a field access which can't be optimized to access property directly.

diff -r 867ea9c125ad src/compilerJs/fan/ast/JsExpr.fan
--- a/src/compilerJs/fan/ast/JsExpr.fan Sun Feb 20 08:50:56 2011 -0500
+++ b/src/compilerJs/fan/ast/JsExpr.fan Tue Feb 22 00:00:34 2011 +0600
@ -464,7 +465,7 @@
   }
   override Void write(JsWriter out)
   {
-    if (lhs is JsFieldExpr && lhs->useAccessor == true)
+    if (lhs is JsFieldExpr && lhs->useAccessor == true && symbol == "=")
     {
       lhs->isSet = true
       lhs.write(out)

andy Mon 21 Feb 2011

@vkuzkokov - can you provide a simple test case?

vkuzkokov Mon 21 Feb 2011

Sorry about that. It actually happens with === and !==

class Main
{
  Void main()
  {
    echo(Log.get("test").level === LogLevel.info)
  }
}

andy Tue 22 Feb 2011

Promoted to ticket #1421 and assigned to andy

Thanks vkuzkokov

andy Thu 8 Jun

Ticket resolved in 1.0.70

This looks fixed - not sure when - possibly from here

Login or Signup to reply.