On Mon, Jun 18, 2012 at 1:03 AM, Jez <jezreel@...> wrote:
> Hi,
>
> I was trying to fix #1910 and related issues by checking that the targets in
> 'for [target] in ...' and 'except Exception as [target]' are assignable
> expressions. However, rather than adding checkAssign calls at those sites, I
> wonder if it would be more elegant to do a check whenever we construct an
> expression. Specifically, I was thinking of calling checkGenericAssign() in
> the @after hooks of both 'expr' and 'test' constructors whenever the
> contextType is 'Store'. This approach should also eliminate the need for the
> checkAssign call, since every component of a Tuple or List that is used in a
> 'Store' context should have been verified to be assignable already.
That sounds like a good idea, thanks for looking into it!
> Are there any problems with this approach, or does it sound good?
I can't think of any off the top of my head - it would be nice to
eliminate the recursion on that one.
> Also, I'm not clear what the difference between the expr.etype and expr.tree
> attributes are. Would be great if someone enlightened me :)
etype is our own return type. ANTLR produces expr.tree automatically,
but in a form that we can't use directly. IIRC the only time I need to
use expr.tree is when we need to collect nodes with +=
I'll double check to make sure I'm correct about expr.tree, it's been a while.
-Frank
|