Commit ee9a3a41 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Some fixes

parent 02483cc1
...@@ -35,6 +35,7 @@ Box* astInterpretFrom(CompiledFunction* cf, AST_stmt* start_at, BoxedDict* local ...@@ -35,6 +35,7 @@ Box* astInterpretFrom(CompiledFunction* cf, AST_stmt* start_at, BoxedDict* local
AST_stmt* getCurrentStatementForInterpretedFrame(void* frame_ptr); AST_stmt* getCurrentStatementForInterpretedFrame(void* frame_ptr);
CompiledFunction* getCFForInterpretedFrame(void* frame_ptr); CompiledFunction* getCFForInterpretedFrame(void* frame_ptr);
struct FrameInfo;
FrameInfo* getFrameInfoForInterpretedFrame(void* frame_ptr); FrameInfo* getFrameInfoForInterpretedFrame(void* frame_ptr);
void gatherInterpreterRoots(gc::GCVisitor* visitor); void gatherInterpreterRoots(gc::GCVisitor* visitor);
......
...@@ -619,7 +619,8 @@ private: ...@@ -619,7 +619,8 @@ private:
builder->CreateStore(converted_value->getValue(), builder->CreateConstInBoundsGEP2_32(exc_info, 0, 1)); builder->CreateStore(converted_value->getValue(), builder->CreateConstInBoundsGEP2_32(exc_info, 0, 1));
converted_value->decvref(emitter); converted_value->decvref(emitter);
ConcreteCompilerVariable* converted_traceback = traceback->makeConverted(emitter, UNKNOWN); ConcreteCompilerVariable* converted_traceback = traceback->makeConverted(emitter, UNKNOWN);
builder->CreateStore(converted_traceback->getValue(), builder->CreateConstInBoundsGEP2_32(exc_info, 0, 2)); builder->CreateStore(converted_traceback->getValue(),
builder->CreateConstInBoundsGEP2_32(exc_info, 0, 2));
converted_traceback->decvref(emitter); converted_traceback->decvref(emitter);
return getNone(); return getNone();
......
...@@ -527,6 +527,13 @@ private: ...@@ -527,6 +527,13 @@ private:
made->col_offset = orig->col_offset; made->col_offset = orig->col_offset;
made->lineno = orig->lineno; made->lineno = orig->lineno;
return made; return made;
} else if (val->type == AST_TYPE::Index) {
AST_Index* orig = ast_cast<AST_Index>(val);
AST_Index* made = new AST_Index();
made->value = _dup(orig->value);
made->col_offset = orig->col_offset;
made->lineno = orig->lineno;
return made;
} else { } else {
RELEASE_ASSERT(0, "%d", val->type); RELEASE_ASSERT(0, "%d", val->type);
} }
......
...@@ -100,7 +100,7 @@ Box* generatorThrow(Box* s, BoxedClass* e) { ...@@ -100,7 +100,7 @@ Box* generatorThrow(Box* s, BoxedClass* e) {
assert(isSubclass(e, Exception)); assert(isSubclass(e, Exception));
BoxedGenerator* self = static_cast<BoxedGenerator*>(s); BoxedGenerator* self = static_cast<BoxedGenerator*>(s);
Box* ex = exceptionNew1(e); Box* ex = exceptionNew1(e);
self->exception = ExcInfo(ex->cls, ex, NULL); self->exception = ExcInfo(ex->cls, ex, None);
return generatorSend(self, None); return generatorSend(self, None);
} }
......
...@@ -221,7 +221,7 @@ extern "C" void exit(int code) { ...@@ -221,7 +221,7 @@ extern "C" void exit(int code) {
} }
void raise0() { void raise0() {
raiseRaw(ExcInfo(last_exc->cls, last_exc, NULL)); raiseRaw(ExcInfo(last_exc->cls, last_exc, None));
} }
bool ExcInfo::matches(BoxedClass* cls) const { bool ExcInfo::matches(BoxedClass* cls) const {
......
...@@ -44,4 +44,7 @@ def f2(): ...@@ -44,4 +44,7 @@ def f2():
f2() f2()
print f(4, 2) print f(4, 2)
print f(4.1, 2.3) try:
print f(4.1, 2.3)
except TypeError, e:
print e
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