Commit 55c2366f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Use an AST_Str for IMPORT_FROM instead of an AST_Name

Also fix a GCC warning... not sure if this is supposed to be better though.
parent 866e37ac
......@@ -414,13 +414,13 @@ private:
case AST_LangPrimitive::IMPORT_FROM: {
assert(node->args.size() == 2);
assert(node->args[0]->type == AST_TYPE::Name);
assert(node->args[1]->type == AST_TYPE::Name);
assert(node->args[1]->type == AST_TYPE::Str);
CompilerVariable* module = evalExpr(node->args[0], exc_info);
ConcreteCompilerVariable* converted_module = module->makeConverted(emitter, module->getBoxType());
module->decvref(emitter);
const std::string& name = ast_cast<AST_Name>(node->args[1])->id;
const std::string& name = ast_cast<AST_Str>(node->args[1])->s;
assert(name.size());
llvm::Value* r = emitter.createCall2(exc_info, g.funcs.importFrom, converted_module->getValue(),
......
......@@ -1129,7 +1129,7 @@ public:
import_from->lineno = node->lineno;
import_from->col_offset = node->col_offset;
import_from->args.push_back(makeName(tmp_module_name, AST_TYPE::Load));
import_from->args.push_back(makeName(a->name, AST_TYPE::Load));
import_from->args.push_back(new AST_Str(a->name));
std::string tmp_import_name = nodeName(a);
pushAssign(tmp_import_name, import_from);
......
......@@ -669,8 +669,12 @@ Box* longHash(BoxedLong* self) {
// Not sure if this is a good hash function or not;
// simple, but only includes top bits:
double d = mpz_get_d(self->n);
return boxInt(*reinterpret_cast<int64_t*>(&d));
union {
uint64_t n;
double d;
};
d = mpz_get_d(self->n);
return boxInt(n);
}
void setupLong() {
......
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