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/06/06 17:00:29 UTC

[GitHub] [royale-compiler] carlosrovira opened a new issue #152: Missing Semicolon after static const generates error

carlosrovira opened a new issue #152:
URL: https://github.com/apache/royale-compiler/issues/152


   Hi,
   
   in the following code:
   
   ```as3
   public static const RENDER_NORMAL_HEIGHT:int = 74
               
   [Bindable("dataChange")]
   public function get product():Product
   {
           return data as Product;
   }
   ```
   
   If I don't add the semicolon after "74" I get the following error:
   
   ` "Call to a possibly undefined method Bindable."
    `


----------------------------------------------------------------
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-compiler] joshtynjala closed issue #152: Missing Semicolon after static const generates error

Posted by GitBox <gi...@apache.org>.
joshtynjala closed issue #152:
URL: https://github.com/apache/royale-compiler/issues/152


   


----------------------------------------------------------------
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-compiler] joshtynjala edited a comment on issue #152: Missing Semicolon after static const generates error

Posted by GitBox <gi...@apache.org>.
joshtynjala edited a comment on issue #152:
URL: https://github.com/apache/royale-compiler/issues/152#issuecomment-708661904


   I think that both compilers are behaving correctly, and we should not change this.
   
   Consider the following example, which I think helps to demonstrate why making any changes here would be problematic.
   
   ```as3
   public static function NotMetadata(value:String):int {
   	return 0;
   }
   
   public static const MY_ARRAY:Array = [1, 2, 3];
   
   public static const RESULT:int = MY_ARRAY[NotMetadata("foobar")]
   ```
   
   This code unambigiously uses array access and calls a static function, named NotMetadata.
   
   However, ActionScript allows us to add some whitespace between MY_ARRAY and the [ character, like in the next example below:
   
   ```as3
   public static const RESULT:int = MY_ARRAY
   
   [NotMetadata("foobar")]
   ```
   
   The whitespace should not change the resulting syntax tree. It's still the same code. Just formatted differently.
   
   The same is true if we use Bindable instead of NotMetadata.
   
   We shouldn't treat certain metadata (like Bindable) as a special case because ActionScript allows developers to invent arbitrary new metadata with any name that they want. They'll expect their custom metadata to behave the same, but we cannot guarantee that without breaking valid code, like what I included in my previous example.


----------------------------------------------------------------
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-compiler] carlosrovira commented on issue #152: Missing Semicolon after static const generates error

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


   Hi Josh,
   maybe the solution is not about a semicolon (I think that's ok too), but the error seems to me a bug (even if flex worked the same, doesn't seem to me ok). I mean, it's normal to write sentences without semicolons, but the start of a metadata that should be detected and the error ("Call to a possibly undefined method Bindable."), seems to me inapropiate.
   do you think this should remain in the current shape?


----------------------------------------------------------------
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-compiler] joshtynjala commented on issue #152: Missing Semicolon after static const generates error

Posted by GitBox <gi...@apache.org>.
joshtynjala commented on issue #152:
URL: https://github.com/apache/royale-compiler/issues/152#issuecomment-708551034


   I just checked how classic Flex SDK compiler behaves, and it produces the exact same error. With that in mind, I believe that the Royale compiler is behaving correctly here.
   
   The opening character `[` for metadata probably does not result in automatic semicolon insertion because it might also be intended as array access (even if it's not on the same line).


----------------------------------------------------------------
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-compiler] joshtynjala commented on issue #152: Missing Semicolon after static const generates error

Posted by GitBox <gi...@apache.org>.
joshtynjala commented on issue #152:
URL: https://github.com/apache/royale-compiler/issues/152#issuecomment-708661904


   I think that both compilers are behaving correctly, and we should not change this.
   
   Consider the following example, which I think helps to demonstrate why making any changes here would be problematic.
   
   ```as3
   public static function NotMetadata(value:String):int {
   	return 0;
   }
   
   public static const MY_ARRAY:Array = [1, 2, 3];
   
   public static const RESULT:int = MY_ARRAY[NotMetadata("foobar")]
   ```
   
   This code unambigiously uses array access and calls a static function, named NotMetadata.
   
   However, ActionScript allows us to add some whitespace between MY_ARRAY and the [ character, like in the next example below:
   
   ```as3
   public static const RESULT:int = MY_ARRAY
   
   [NotMetadata("foobar")]
   ```
   
   Regardless, we shouldn't treat certain metadata (like Bindable) as a special case because ActionScript allows developers to invent arbitrary new metadata with any name that they want. They'll expect their custom metadata to behave the same, but we cannot guarantee that without breaking valid code, like what I included in my previous example.


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