Harbs commented on issue #203:
URL: https://github.com/apache/royale-compiler/issues/203#issuecomment-998553088


   This was a vast improvement. I did find some more cases of unnecessary 
quoting:
   1. `toString` and `indexOf`:
   ```
   if(!pg.runtimeQualifiers.(text().toString().indexOf("image_name") == 
0).length()){
       name = "";
   }
   ```
   
   compiles to:
   
   ```
     if (!pg.runtimeQualifiers.filter(function(/** @type {XML} */ node){return 
(node.text()["toString"]()["indexOf"]("image_name") == 0)}).length()) {
       name = "";
     }
   ```
   
   `pg` is a class. `runtimeQualifiers` is an `XMLList`.
   
   2. Another one, that's not XML related at all (`hasOwnProperty`):
   ```
   if(value[i].hasOwnProperty("selected")){
       item.selected = value[i]["selected"];
   }
   ```
   
   compiles to:
   
   ```
   if (value[i]["hasOwnProperty"]("selected")) {
       item.selected = !!(value[i]["selected"]);
   }
   
   ```
   
   I don't think `hasOwnProperty` ever needs to be quoted. Here `value` is an 
array of objects, but `value` in this case is actually types as an `Object` 
instead of an array. I don't know if that makes a difference.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to