daviis / PyDucker

A static ducking tool for python 3 source code
2 stars 2 forks source link

visit_Index, visit_Slice, visit_Subscript #67

Closed JakeAlbee closed 9 years ago

JakeAlbee commented 9 years ago

I'll split this up into things I've done.

Files Changed

I made a NonIntIndexException because as far as I could tell only visit_Index requires the value to be an integer. visit_Slice only requires you to implement the index magic method. So it's handled two different ways since as far as I could tell, visit_Index wouldn't work even if you implement index but I couldn't find anything conclusive on that so it's worth looking into if someone else can find something.

JakeAlbee commented 9 years ago

Updated and should work now, I see what you were saying.

Though I'm not sure how collections work so I'll have to be briefed on that during the meeting tomorrow and I'll take a look at it tonight to see if I'll have any questions tomorrow

daviis commented 9 years ago

At the end of the test the object in scope that goes with 'y' gets reassigned to have the bean.name 'c'. Also 'c' in scope is a list of type int. It should only be of type int.

I have updated slice.py to have a 'pass' at the end, this way you can set a break point in the debugger on visit_pass and see the state of the scope/namespace

daviis commented 9 years ago

The problem with y will be in visit_assign. The problem with c is likely in visit_index? (maybe)

JakeAlbee commented 9 years ago

visitIndex is correctly returning a varBean without a name, , since it isn't using named things to index with for sure, I'll take a step up and lok at visit_Subscript and see if it's in there

JakeAlbee commented 9 years ago

And it's returning just the type integer, not that it is a list.

JakeAlbee commented 9 years ago

I'm running into issues with the dictionary since the walker can't access what was called before it, so it doesn't know it is a dictionary (which can indeed use a str to index) and throwing an index error. I'm not sure how to get around that.

JakeAlbee commented 9 years ago

As far as I can tell visit_Ellipses works fine and doesn't really do anything. I couldn't get it (or any other extended slice ideas) to not throw a syntax error.

JakeAlbee commented 9 years ago

This should be pretty much good to go.

The only bug I see is that I'm not matching value to key pairs in the dictionary and not handling non-homogenous value types in the dictionary. I wasn't sure how to do that. Otherwise it's working as expected.

daviis commented 9 years ago

I'll merge it in then check it with my changes to see what breaks and hopefully fix all of the unit tests by tomorrow.

daviis commented 9 years ago

I'll merge it in then check it with my changes to see what breaks and hopefully fix all of the unit tests by tomorrow.

daviis commented 9 years ago

I'll merge it in then check it with my changes to see what breaks and hopefully fix all of the unit tests by tomorrow.