Commit 03e4ab92 authored by Boxiang Sun's avatar Boxiang Sun

pypy parser treat all complex statment as 0.0j, fix it, code orginally write by Marius

parent 8ffb67ac
...@@ -363,10 +363,19 @@ struct expr_dispatcher { ...@@ -363,10 +363,19 @@ struct expr_dispatcher {
} }
ResultPtr read(pypa::AstComplex& c) { ResultPtr read(pypa::AstComplex& c) {
AST_Num* ptr = new AST_Num(); AST_Num* imag = new AST_Num();
ptr->num_type = AST_Num::COMPLEX; location(imag, c);
pypa::string_to_double(c.imag, ptr->n_float); imag->num_type = AST_Num::COMPLEX;
return ptr; sscanf(c.imag.c_str(), "%lf", &imag->n_float);
if (!c.real)
return imag;
AST_BinOp* binop = new AST_BinOp();
location(binop, c);
binop->op_type = AST_TYPE::Add;
binop->right = readItem(c.real, interned_strings);
binop->left = imag;
return binop;
} }
ResultPtr read(pypa::AstComprehension& c) { ResultPtr read(pypa::AstComprehension& c) {
......
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