Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Perry van Wesel
@Perryvw
or decorators
Janne Varjo
@Janne252
I used ts.createImmediatelyInvokedArrowFunction instead of manually making a (function() return blah end)() for example
What about the broken tests? Should I just fix the ones that broke because of added white space?
Perry van Wesel
@Perryvw
if it's just whitespace sure
didnt even know immediatelyinvokedarrowfunction was a thing
Perry van Wesel
@Perryvw
idk if we even support that :D
but sounds good
Janne Varjo
@Janne252
It does work, I didn't even check!
Perry van Wesel
@Perryvw
I guess it does if the tests work
probably just turns it into a call expression of an arrow function
Janne Varjo
@Janne252
Yeah, immediatelyinvokedarrowfunction sounds like a helper anyway, a composition of existing expressions
Perry van Wesel
@Perryvw
#164 is quite the hack
have to do some researching how and if we want to support these cases
Janne Varjo
@Janne252
@Perryvw Would you mind commenting on #164 why do you consider it a hack, please? In my opinion the only unclear part is transpileBinaryExpressionLeft because it literally only adds support for count = count + count++. I think we can live without that. transpileSelfAssigningUnaryExpression exists because we don't have support for chained assignments/wrapping assigning binary expressions when context requires it. Perhaps we can merge the unary parsing & re-visit the topic when support for chained assignments/assigning binary expressions is implemented.
Perry van Wesel
@Perryvw
will do after work
like I said I'm not sure either how to improve it
have to do some research and experimenting myself
Janne Varjo
@Janne252
👍
Janne Varjo
@Janne252
@Perryvw Not sure if I managed to get the point across. The solution is to turn prefix unary into a chained assignment (++i -> i = i + 1 and j = ++i -> j = i = i + 1). Yes, lua doesn't support that. As I mentioned, binaryExpression transpilation would take care of that (figuring out when an assignment expression needs to be wrapped), e.g. j = i++ -> j = i = i + 1 -> j = (function() i = i + 1; return i end)(), 2 steps. Postfix ofc has to be handled differently in unary transpilation; j = i++ -> j = (function i_before = i; i = i + 1; return i_before end)(), 1 step.
Perry van Wesel
@Perryvw
that is basically what I proposed right?
Janne Varjo
@Janne252
Both have same result I believe, my proposition doesn't handle ++i in unary transpiling but rather lets binary expression take care of that, so that we'd get both unaries and chained assignments instead of just unaries.
Perry van Wesel
@Perryvw
Still not sure if we should support this, me and lolleko are both pretty busy right now
until in or after the weekend
Janne Varjo
@Janne252
Still not sure if we should support this = Chained assignments, right? 50% of probelmatic unaries can be solved by supporting chained assignments, that's why I'm suggesting it. You'll have to figure out when the context requires a wrapper function so it might make sense to make it a more general solution & solve 2 problems at once.
Still have to clean it up a little more
but that is the general idea
Janne Varjo
@Janne252
Looking good. I added one requested change regarding a variable name clash.
Perry van Wesel
@Perryvw
yeah I was thinking of adding just the lhs to the variable name
but I'm still thtinking about what happens if the lhs is not an identifier
Janne Varjo
@Janne252
The one I commented about can only occur in postfix unary (i++), wouldn't you always have an identifier on LHS? Isn't that the only case where you have to store a temp var anyway to resolve an assignment expression?
Perry van Wesel
@Perryvw
I don't think it is always an identifier according to the AST
maybe it is in practice
have to think about it a little
Janne Varjo
@Janne252
I think it is since it's always assigning the result to the variable it's operating on, unlike !var.
Perry van Wesel
@Perryvw
yeah something like that
sounds right
can you do operations on tuples?
Janne Varjo
@Janne252
I don't think you can until the tuple is unpacked, e.g. let [a, b] = [1, 2]; a++;, not sure if I understood correctly
Perry van Wesel
@Perryvw
probably
Janne Varjo
@Janne252
Is #165 going to be merged or are you looking into other options improving the command line arguments parsing & merging with tsconfig?
Perry van Wesel
@Perryvw
we want to rewrite the CLI part to get rid of the yarg dependencies at some point
but I'm okay with merging this in the mean time
@lolleko ?
Lorenz Junglas
@lolleko
we really need to get eid of yargs imo
rid*
and replace it wirh minimist
and the replace minimist with our own parser
but until i have time to do that, im fine with merging #165
Perry van Wesel
@Perryvw
@Janne252 merged