[GitHub] [royale-compiler] Harbs edited a comment on issue #203: XML.toXMLString() not recognized by the compiler

2021-12-21 Thread GitBox


Harbs edited a comment 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: issues-unsubscr...@royale.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org




[GitHub] [royale-compiler] Harbs edited a comment on issue #203: XML.toXMLString() not recognized by the compiler

2021-12-16 Thread GitBox


Harbs edited a comment on issue #203:
URL: https://github.com/apache/royale-compiler/issues/203#issuecomment-996041219


   Yup. Basically there's a tradeoff here. It's good to know the details. I'll 
have to write this up in the docs before I forget...  


-- 
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: issues-unsubscr...@royale.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org