'it' is not defined when referenced only by object literals? #899
Comments
More complicated than just the object literal, it's something to do with the shorthand. ->
{ name: it.name } compiles to => (function(it){
return {
name: it.name
};
}); Similarly, -> { it } compiles to => (function(){
return {
it: it
};
}); |
From code readibility point of view I don't like I wish we could:
|
My reading of the (I have a fix for this bug that's part of a slightly larger unit of work; I'll be PRing it one of these days, either with that work or separately.) |
@rhendric : I beg to differ. My understanding (which of course does not agree with LSC master) had been: the unnamed implicit single argument of the innermost function without an explicit parameter list i.e. As for a stricter syntax, I believe we should emit warning/error when:
Regardless I'm looking forward to your big chunk of change ;) |
Upon revisiting this, it appears that I had entirely imagined this aliasing feature! I thought that was how things worked already in some cases, but I'm quite happy that it isn't. For the record, I retract my ‘should’ above: I'll hold further opining on issuing warnings or errors for possibly confusing uses of |
if (result) {
data = {
name: that.name
};
} |
Add test cases and fix implicit it in object shorthands (#899)
compiles to:
the third function has no argument
Another example:
The text was updated successfully, but these errors were encountered: