Commit 96cc5efa authored by Kevin Modzelewski's avatar Kevin Modzelewski

some minor changes

parent a950719f
......@@ -444,7 +444,7 @@ private:
virtual void visit_delete(AST_Delete* node) {
for (AST_expr* target : node->targets) {
RELEASE_ASSERT(target->type == AST_TYPE::Subscript, "");
getType(target);
getType(ast_cast<AST_Subscript>(target)->value);
}
}
......
......@@ -1351,12 +1351,6 @@ private:
case AST_TYPE::Subscript:
_doDelitem(static_cast<AST_Subscript*>(target), exc_info);
break;
case AST_TYPE::Attribute:
// delete an attribute
case AST_TYPE::Name:
// delete a instance
RELEASE_ASSERT(target->type == AST_TYPE::Subscript, "");
break;
default:
ASSERT(0, "UnSupported del target: %d", target->type);
abort();
......
......@@ -950,10 +950,6 @@ public:
target = astsubs;
break;
}
case AST_TYPE::Name:
case AST_TYPE::Attribute:
RELEASE_ASSERT(t->type == AST_TYPE::Subscript, "");
default:
RELEASE_ASSERT(0, "UnSupported del target: %d", t->type);
}
......
......@@ -386,12 +386,10 @@ Box* listRemove(BoxedList* self, Box* elt) {
Box* listReverse(BoxedList* self) {
assert(self->cls == list_cls);
if (self->size > 0) {
for (int i = 0, j = self->size - 1; i < j; i++, j--) {
Box* e = self->elts->elts[i];
self->elts->elts[i] = self->elts->elts[j];
self->elts->elts[j] = e;
}
for (int i = 0, j = self->size - 1; i < j; i++, j--) {
Box* e = self->elts->elts[i];
self->elts->elts[i] = self->elts->elts[j];
self->elts->elts[j] = e;
}
return None;
......
......@@ -44,5 +44,19 @@ except ValueError, e:
print "ok"
print l
l.reverse()
print l
for i in xrange(5):
l = range(i)
l.reverse()
print l
# growing and shrinking a list:
l = []
for i in xrange(100):
l.append(i)
while l:
del l[0]
print l
for i in xrange(100):
l.append(i)
while l:
del l[0]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment