rokucommunity / rokucommunity/brighterscript
@/callfunc transformation should honor the default values of a function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 208
- Forks
- 68
- Avg merge
- 8h 39m
- Merged PRs (30d)
- 39
Description
first of all: the current behavior is totally documented, you can treat this as a "feature request"/improvement.
Let's say I have this function in my component
sub myFunction(myFlag = true as boolean)
...
end sub
and I try to invoke it from the external with the @ syntax. I don't pass any value so I assume that myFlag is set to true
myComponent@.myFunction()
but bsc compiles the snippet to
myComponent.callfunc("myFunction", invalid)
witch translates to the runtime error: Type Mismatch. Unable to cast "roInvalid" to "Boolean".
Ideally, instead, the translation of @ should check if the first value of the function has a default value, and use it. In this case compiling to
myComponent.callfunc("myFunction", true)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with docs/callfunc-operator.md, especially the documented no-argument evaluation section, then trace bsc’s @/callfunc transformation for myComponent@.myFunction(). Done means the generated callfunc argument honors the function’s declared default instead of emitting invalid, with coverage for the example behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100