Fixed debuger problems.

This commit is contained in:
yhirose 2015-08-04 13:04:58 -04:00
parent 86ef99d48a
commit efcba540b1

View File

@ -101,9 +101,9 @@ struct CommandLineDebugger
}
shared_ptr<Ast> find_function_node(const Ast& ast) {
auto node = ast.parent_node;
while (node->parent_node && node->tag != "FUNCTION"_) {
node = node->parent_node;
auto node = ast.parent;
while (node->parent && node->tag != "FUNCTION"_) {
node = node->parent;
}
return node;
}
@ -138,8 +138,12 @@ struct CommandLineDebugger
set<string> references;
enum_identifiers(*node, references);
for (const auto& symbol: references) {
const auto& val = env.get(symbol);
cout << symbol << ": " << val.str() << endl;
if (env.has(symbol)) {
const auto& val = env.get(symbol);
if (val.type != Value::Function) {
cout << symbol << ": " << val.str() << endl;
}
}
}
}