You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@royale.apache.org by GitBox <gi...@apache.org> on 2020/12/09 22:02:57 UTC

[GitHub] [royale-asjs] estanglerbm opened a new issue #996: Error on indexed array syntax with string literal on Proxy

estanglerbm opened a new issue #996:
URL: https://github.com/apache/royale-asjs/issues/996


   For this code:
   
   ```
   var props:Proxy = new Proxy();
   props["test"] = new Proxy();
   props["test"]["width"] = 10;
   ```
   
   The compiler generates this:
   
   ```
   props.setProperty("test", new org.apache.royale.utils.Proxy());
   props.getProperty('"test"')["width"] = 10;
   ```
   
   which results in this error:
   
   ```
   Uncaught TypeError: props.getProperty(...) is undefined
   ```
   
   The problem is that the get is embedding the double quotes.  Is that expected?
   
   If I can set it, it seems like I should be able to get it with the same value.  (Of course I could filter out the double quotes in the getProperty(), but is that right?)
   
   ---
   
   If I change the code to:
   
   ```
   var props:Proxy = new Proxy();
   props["test"] = new Proxy();
   (props["test"] as Proxy)["width"] = 10;
   ```
   
   then it generates:
   
   ```
   props.setProperty("test", new org.apache.royale.utils.Proxy());
   org.apache.royale.utils.Language.as(props.getProperty('"test"'), org.apache.royale.utils.Proxy).setProperty("width", 10);
   ```
   
   which is still wrong.
   
   I understand what was said in  #977.
   


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-742141878


   Additionally, this code:
   
   ```
   props["block"] = props["test"];
   ```
   
   generates this:
   
   ```
   props.setProperty("block", props.getProperty('"test"'));
   ```
   
   which has the embedded double quotes on the right-hand-side getProperty().
   
   Perhaps the compiler doesn't like two uses of indexed array syntax in the same statement?
   


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-742161645


   Single quotes are similarly broken in these situations:
   
   ```
   var s:String = obj['supplies'];
   ```
   
   and
   
   ```
   <js:Label text="{obj['supplies']}" />
   ```
   
   For single quotes, seems it doesn't like the right-hand side of an assignment or a return.
   


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-753470836


   @carlosrovira I haven't tried that option in debug mode (I use it regularly in release mode).
   
   But I don't think the compiler should be doing this in any mode by default.  This issue lists several cases where the compiler generates invalid code (involving single quotes), in addition to several cases of wrong behavior (involving double quotes).
   
   The ObjectProxy code I submitted has a workaround for the double quotes issue, so while all the situations need a fix, the single quotes problem is the more severe, at the moment.
   
   **I think the core problem is that the compiler is adding single quotes as part of ``getProperty('...')`` without check if the value is already surrounded by single quotes or double quotes.**  If it's already surrounded by single or double quotes, it should just add it as ``getProperty(...)``.


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm edited a comment on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm edited a comment on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-742161645


   Single quotes are similarly broken in these situations:
   
   ```
   var s:String = obj['supplies'];
   ```
   
   and
   
   ```
   <js:Label text="{obj['supplies']}" />
   ```
   
   (Aside:  I know that it should be ``text="{obj.supplies}"`` for it to actually work for binding.)
   
   For single quotes, seems it doesn't like the right-hand side of an assignment or a return.
   


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-755156534


   This is fixed in latest compiler.


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-742145065


   What about single quotes?  Oh, even more fun:
   
   ```
   props['block'] = props['test'];
   ```
   
   generates:
   
   ```
   props.setProperty('block', props.getProperty(''test''));
   ```
   
   and that leads to a loading error for the app.
   


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] carlosrovira commented on issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
carlosrovira commented on issue #996:
URL: https://github.com/apache/royale-asjs/issues/996#issuecomment-742405685


   Hi, maybe you need to add this compiler option? `-js-dynamic-access-unknown-members=true`


----------------------------------------------------------------
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.

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



[GitHub] [royale-asjs] estanglerbm closed issue #996: Error on indexed array syntax with string literal on Proxy

Posted by GitBox <gi...@apache.org>.
estanglerbm closed issue #996:
URL: https://github.com/apache/royale-asjs/issues/996


   


----------------------------------------------------------------
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.

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