BowlerHatLLC / vscode-as3mxml

ActionScript & MXML language extension for Visual Studio Code. Develop apps for Adobe AIR, Adobe Flash Player, or Apache Royale.
https://as3mxml.com/
Apache License 2.0
256 stars 39 forks source link

Display code hinting inside type checking block #717

Closed ylazy closed 9 months ago

ylazy commented 9 months ago

Hi!

Just an idea. Is it possible for type inference in these cases?

var object:*;

if (object is ActionButton)
{
  object. // display code hint for ActionButton without (object as ActionButton) needed.
}
else if (object is Button)
{
  object. // display code hint for Button without (object as Button) needed.
}

Thanks!

joshtynjala commented 9 months ago

This would need to be modified in the Royale compiler. While vscode-as3mxml could probably hack something together without compiler changes when object is of type * or Object, when it's a non-dynamic class, it requires a cast.