Skip to content

Allows "as <CustomType>" in parameter and return type declarations#262

Merged
TwitchBronBron merged 10 commits intorokucommunity:masterfrom
markwpearce:feature/as_custom_type
Jan 12, 2021
Merged

Allows "as <CustomType>" in parameter and return type declarations#262
TwitchBronBron merged 10 commits intorokucommunity:masterfrom
markwpearce:feature/as_custom_type

Conversation

@markwpearce
Copy link
Collaborator

I don't think this works yet "inside" a namespace...

@markwpearce markwpearce marked this pull request as draft January 4, 2021 18:22
@markwpearce markwpearce changed the title [WIP] Added CustomType which can be used as placeholder for a class name [WIP] Allows "as <CustomType>" in parameter and return type declarations Jan 4, 2021
@markwpearce
Copy link
Collaborator Author

I updated the PR with your comments - I also realized typings on class fields weren't being verified.. Not sure If i'm doing that correctly or not.... Namespaces are still not correctly checked though. :(

@TwitchBronBron
Copy link
Member

@elsassph I'd appreciate your thoughts on this PR.

Copy link
Contributor

@elsassph elsassph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@markwpearce markwpearce changed the title [WIP] Allows "as <CustomType>" in parameter and return type declarations Allows "as <CustomType>" in parameter and return type declarations Jan 7, 2021
@markwpearce
Copy link
Collaborator Author

markwpearce commented Jan 7, 2021

This now works with namespaces!

This would be valid Brighterscript code:

Vehicles.bs:

namespace Vehicles

  class Car
  end class

  class MonsterTruck
    function driveOver(automobile as Car) as Trash.SquashedCar
      return new Trash.SquashedCar()
    end function
  end class

end namespace

Trash.bs

namespace Trash

  class SquashedCar
  end class

end namespace

@markwpearce markwpearce marked this pull request as ready for review January 7, 2021 18:05
@markwpearce markwpearce force-pushed the feature/as_custom_type branch from 39c11f3 to 14aca9f Compare January 7, 2021 18:06
@markwpearce markwpearce force-pushed the feature/as_custom_type branch from b692f03 to c2cf523 Compare January 12, 2021 00:51
@markwpearce
Copy link
Collaborator Author

@TwitchBronBron - I think everything you brought up has been addressed.

@TwitchBronBron TwitchBronBron merged commit 5313027 into rokucommunity:master Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants